Newbie problems with plot2d



About calling quadpack functions in a plottable function,
try writing it as quad_foo(...)[1] instead of first(quad_foo(...))
x[1] where x is not a list is OK but not first(x).
(Yes, it is unclear and confusing to try to distinguish
between programming functions and symbolic functions.
Sorry about that.)

About arrays, Maxima has inconsistent policies about arrays.
My advice is to just use lists and matrices instead.
(Yes, this is a mess. Sorry again.)

Hope this helps,
Robert Dodier

On 6/14/11, carolus <worwor at bellsouth.net> wrote:
> Neither of the two approaches used in the following script generates
> arguments acceptable to plot2d.  (My intent is to use maxima for
> prototyping and debugging fortran, so I want to stay as close as
> possible to fortran idiom, particularly with respect to array usage.)
> Any help would be appreciated.
>
> **********************
> lognormal(x) := (1/x)*exp(-(log(x/x0))^2/(2*sig^2));
> tfmi(t) := first(quad_qagi(lognormal(s)*exp(-s*t), s, 10^-16, inf));
> x0:2; sig:2; amp:0.1;
> tfmi(0.1); /* OK */
> tfmi(1.0); /* OK */
> numberp(tfmi(0.1)); /* true */
> plot2d(tfmi(t),[t,0.1,1]); /* fails */
>
> array(tvec, 20);
> array(yvec, 20);
> for i:0 step 1 thru 19 do
> block(
>    tvec[i]: 0.1*i,
>    yvec[i]: tfmi(tvec[i])
>    );
> display(tvec[3],yvec[3]); /* OK */
> plot2d([discrete,tvec,yvec]);  /* fails */
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>