[GiNaC-devel] Find length of a vector
Richard B. Kreckel
kreckel at in.terlu.de
Sat Nov 2 12:31:21 CET 2024
Hi,
On 11/2/24 12:11 PM, Jan Rheinländer via GiNaC-devel wrote:
> trying to find the length of a vector by taking the square root of the
> scalar product, I get this (in ginsh):
>
>> v = [[a,b]];
> [[a,b]]
> > r = sqrt(v * transpose(v));
> sqrt([[a,b]]*[[a],[b]])
> > evalm(r);
> matrix::pow(): don't know how to handle exponent
>
> The reason is that the scalar product evaluates to a matrix with a
> single element, not to a numeric.
There are just matrix products evaluating to matrices. There is no
special case for scalar products (apart from the quite special stuff in
indexed.h).
> Is that intended?
Well, it's the way it is designed. ;-)
-richy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20241102/cd67c0a2/attachment.sig>
More information about the GiNaC-devel
mailing list