Need help to interpret unusual Maxima notation for a derivative i.e. (d^{y+1}/dx^{y+1}) rho
Subject: Need help to interpret unusual Maxima notation for a derivative i.e. (d^{y+1}/dx^{y+1}) rho
From: Martin Schönecker
Date: Tue, 09 Jun 2009 08:34:20 +0200
I'm not personally affected by the issue right now, but I once wondered
why fortran() doesn't actually return the string it prints?
Assigning the result to a variable, as suggested by Vishal, would allow
to store the result in a file using save() or stringout(), but it seems
that one has to copy'n'paste from the window, as fortran() results in
true (and f90() results in false). That was fine with me, but these
functions could be more useful if they returned a string, just as
string() does.
Martin
(%i1) kill(all);
(%o0) done
(%i1) load("f90");
(%o1) C:/Programme/Maxima-5.18.1/share/maxima/5.18.1/share/contrib/f90.lisp
(%i2) expr: a+b=c;
(%o2) b+a=c
(%i3) eqf: fortran(expr);
b+a = c
(%o3) done
(%i4) eqf90: f90(expr);
b+a = c
(%o4) false
(%i5) eqstr: string(expr);
(%o5) b+a = c
Robert Dodier schrieb:
> 2009/6/8 Vishal Ramnath <VRamnath at nmisa.org>:
>
>> My next challenge is once I set up the finite difference scheme for the
>> underlying PDE's is to write the m-files in Gnu Octave to solve.
>
> Bear in mind that Maxima includes LAPACK functions
> and a separate implementation of the LU decomposition
> and some other linear algebra functions.
> Maybe you can tell us what you want to solve & we'll try to help.
>
>> eq_octave: fortran(eq_new);
>>
>> and just replace the square brackets with round brackets in Notepad++ say.
>
> Hmm. I see fortran(a[i]) renders the subscript with square brackets;
> that seems like a bug to me since Fortran uses parentheses for
> subscripts.
>
> However f90(a[i]) outputs parentheses. load(f90) loads the f90 function.
> Maybe that's worth a try.
>
>> The only catch is that I might have to do this "manually" because I not sure
>> how to iterate over a list of variables in Maxima e.g. {rho, u, x} with
>> something like a for loop which only works with numbers.
>
> Try this: for x in L do (...) where L is some list.
> This is like "foreach" is some other languages.
>
> HTH
>
> Robert Dodier