Reading matrix and making a plot



Dan Kregar <dan.kregar at gmail.com> writes:
> Dear Robert,
>
> Thanks, it matters. But in case you know how to plot / draw the below
> matrix data it would be great (a being indep. variable, b and c being its
> mapped values).
>
> with_stdout ("data.txt", for x:0 thru 10 do (
>        a:x/1.0,
>        b:x^2/1.0,
>        c:x^3/1.0,
>        print(a,b,c)));
>    data: read_matrix("data.txt");
>
>    When I read data into Maxima
>
>    data: read_matrix("data.txt");

A really low-tech solution:

  Maxima 5.31.3 http://maxima.sourceforge.net
  using Lisp GNU Common Lisp (GCL) GCL 2.6.9 (a.k.a. GCL)
  Distributed under the GNU Public License. See the file COPYING.
  Dedicated to the memory of William Schelter.
  The function bug_report() provides bug reporting information.
  (%i1) with_stdout ("data.txt", for x:0 thru 10 do (
         a:x/1.0,
         b:x^2/1.0,
         c:x^3/1.0,
         print(a,b,c)));
  (%o1)                                done
  (%i2) A: transpose(read_matrix("data.txt"));
        [ 0.0  1.0  2.0  3.0   4.0    5.0    6.0    7.0    8.0    9.0    10.0  ]
        [                                                                      ]
  (%o2) [ 0.0  1.0  4.0  9.0   16.0  25.0   36.0   49.0   64.0   81.0   100.0  ]
        [                                                                      ]
        [ 0.0  1.0  8.0  27.0  64.0  125.0  216.0  343.0  512.0  729.0  1000.0 ]
  (%i3) plot2d ([[discrete, A[1], A[2]], [discrete, A[1], A[3]]]);
  (%o3) 

If you look at the plot2d section of the manual you'll find more
examples like this (I had to look up how to do it!)

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20131120/e7c88da0/attachment.pgp>;