help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Calc


From: Christopher Dimech
Subject: Re: Using Calc
Date: Wed, 5 May 2021 13:58:36 +0200

> Sent: Wednesday, May 05, 2021 at 11:39 PM
> From: "Eric S Fraga" <e.fraga@ucl.ac.uk>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Using Calc
>
> On Wednesday,  5 May 2021 at 13:31, Christopher Dimech wrote:
> > The following gets matrix multiplication
> >
> > [ [1.,2.,3.] [4.,5.,6.] [7.,8.,9.] ] * [ [9.,8.,7.] [6.,5.,4.] [3., 2.,1.] 
> > ] =>
> >
> > It is then very easy to end up with very long lines.  Is there a
> > solution to this?
>
> I get:
>
> [ [ 1., 2., 3. ]     [ [ 9., 8., 7. ]      [ [ 30.,  24.,  18. ]
>   [ 4., 5., 6. ]   *   [ 6., 5., 4. ]   =>   [ 84.,  69.,  54. ]
>   [ 7., 8., 9. ] ]     [ 3., 2., 1. ] ]      [ 138., 114., 90. ] ]

--------

Doing the following, removes the *

[1, 2, 3] * [4, 2, 6] =>

--------

But the next keeps the +

[1, 2, 3] + [4, 7, 6] =>

It would be better if things remain consistent and we keep the *

--------

And with these two, one can change the values, re-evaluates
and get the correct values

[1, 2, 3] + [4, 133, 6] => [5, 135, 9]

[1, 2, 3] [4, 123, 6] => 268

--------

But with the following,

[ [ 1., 2., 3. ]     [ [ 9., 8., 7. ]      [ [ 30.,  24.,  18. ]
  [ 4., 5., 6. ]   *   [ 6., 5., 4. ]   =>   [ 84.,  69.,  54. ]
  [ 7., 8., 9. ] ]     [ 3., 2., 1. ] ]      [ 138., 114., 90. ] ]

If you try to change a value, everything gets messed up

[ [ 1., 123., 3. ]     [ [ 9., 8., 7. ]      [ [ 30.,  24.,  18. ]
  [ 4., 5., 6. ]   *   [ 6., 5., 4. ]   =>   [ 84.,  69.,  54. ]
  [ 7., 8., 9. ] ]     [ 3., 2., 1. ] ]      [ 138., 114., 90. ] ]



> as a result so not long lines at all?  Of course, if your system gets
> larger, there will be an issue but then I would suggest you use a
> different language (octave for numerics, maxima for symbolic, both
> usable via org babel src blocks if you wish).  I.e. use the right tool
> for the job?
>
> --
> Eric S Fraga via Emacs 28.0.50 & org 9.4.5 on Debian bullseye/sid
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]