Robert,
This is a really good start. Thanks for your help.
The leading numbers for Fortran continuation will cause a problem
though. It would be great if we could modifiy the Fortran function to
create a Python one. I would be glad to learn this kind of thing.
Maxima Lisp programming is still quite challenging to me - I am still
climbing a steep learning curve.
Thanks again,
Ryan
On 7/3/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> On 7/2/07, Ryan Krauss <ryanlists at gmail.com> wrote:
>
> > If a matrix is composed of [[A,B,C],[D,E,F]] then the output I need is
> > array([[A,B,C],[D,E,F]]).
>
> OK. How about this:
>
> python_matrix (M) := fortran (funmake ('array, [args (M)]));
>
> e.g.
> M : matrix ([cos(x)^3, sin(x)^4, tan(y^5)], [sin(y*x)*cos(y),
> tan(u*v), u^2*v^2]);
> python_matrix (M);
> =>
> array([[cos(x)**3,sin(x)**4,tan(y**5)],[cos(y)*sin(x*y),tan(u*v),u
> 1 **2*v**2]])
>
> If you want to direct the output of fortran into a file,
> wrap it in with_stdout, e.g.
> with_stdout ("/tmp/foo.out", python_matrix (M));
> => (stuff shown above goes into /tmp/foo.out)
>
> The leading "1" on the 2nd line is a continuation character.
> I don't know if you want to try to paste together lines.
> The program to print stuff in Fortran format is not too complex;
> if the Python output can be characterized as a not-too-great
> modification of Fortran, I'll help you modify the output of
> Maxima's fortran function as needed. Generating Python
> output has come up before so maybe a python function
> would be useful to others.
>
> FWIW
> Robert Dodier
>