Subject: Complicated functions fail to keep plotting
From: Richard Hennessy
Date: Mon, 14 Apr 2008 12:39:10 -0400
sorry I will repost when I have more time. Probably today after 6:00 pm est. This needs much more explanation.
Rich
------------Original Message------------
From: "Robert Dodier" <robert.dodier at gmail.com>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "Maxima List" <maxima at math.utexas.edu>
Date: Mon, Apr-14-2008 0:42 AM
Subject: Re: [Maxima] Complicated functions fail to keep plotting
On 4/13/08, Richard Hennessy <rvh2007 at comcast.net> wrote:
> The eval_string does not work.
If you tell us what happens, I think it's more likely we can offer advice.
> The stringout send the output to text files which I plotted using my own program.
It may well be the best way to use Maxima for this problem
is to just generate the numbers and dump them into a file,
and then use Gnuplot or whatever separately.
> Does anyone know how to do this?
What are you trying to accomplish? I'm rather puzzled by the way
stuff is organized, which suggests I don't understand what you're
getting at. Which is too bad because this seems like an interesting
problem, I just can't tell what's going on.
> for e:0 thru 600 do
>
> block(En:e*50/600,k:2/3,m:2,hbar:1,c[-2,e]:0,c[-4,e]:0,c[0,e]:1,
> for n : 2 thru 400 step 2
> do
> c[n,e]:bfloat((c[n-6,e]*k^2*m^2-2*c[n-2,e]*En*m)/(n*(n-1)*hbar^2)),
> f[e](x):=min(2.5, block([p,i,xf],xf:bfloat(1),p:c[0,e],
> for i : 1 thru 200 do (xf:xf*x*x, p:p+c[2*i,e]*xf), p)^2));
My advice is to replace 200, 400, and 600 with symbolic values
(N1, N2, N3, whatever) to make it easier to try different stuff.
If not easier for you, then certainly for us.
> str:concat("explicit(f[",string(0),"]","(x),x,-4,4,y,0,0)");
>
> for i: 1 thru 20 do
> str:concat(str,",explicit(f[",string(i),"](x),x,-4,4,y,",string(i/600*50),",",string(i/600*50),")");
It may not matter, but the right way to build up an expression
is to use the buildq function which works directly with Maxima
expressions, e.g.
makelist (buildq ([i], explicit (f [i] (x), x, - 4, 4, y, i/(600*50),
i/(600*50))), i, 1, 20);
> 'eval_string(str1);
Again, this may not matter, but quoting eval_string prevents it
from being called, so 'eval_string(foo) has no effect ....
> for e : 0 thru 600 do stringout(concat("c:/rich/plist",
> string(e), ".txt"),
> makelist([(x-300)/300*4,e/600*50,f[e]((x-300)/300*4)], x,
> 1, 600));
I don't understand why there are 600 output files.
It appears you want a contour plot or surface plot --
why not dump all the numbers into one file?
This may not matter either, but concat is happy with non-string
atoms such as integers, so: concat("foo", 123, ".txt") => "foo123.txt"
Sorry I can't be more helpful -- maybe you can back up a bit
and give us a little context.
best
Robert Dodier