Bill Allombert on Sun, 25 Oct 2015 12:16:02 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Can 'ploth' draw the dynamic set of functions?


On Sun, Oct 25, 2015 at 03:47:09AM -0700, Yuri wrote:
> Tutorials usually have examples with a fixed function set, like
> this: ploth(X=1,2,[X,log(X)])
> 
> What if I need to draw the computed set of functions? This example fails:
> ff=[X->X,X->log(X)]
> ploth(X=1,2,ff)

You need to actualy call the functions, the two "X" are
different variables, you can do:

ff=[X->X,X->log(X)]
ploth(t=1,2,vector(#ff,i,ff[i](t)))

or equivalently
ff=[X->X,X->log(X)]
ploth(t=1,2,apply(f->f(t),ff)

or alternatively
ff=X->[X,log(X)]
ploth(t=1,2,ff(t))

> Or in simpler case, can I draw the function f(X,N) = {sin(X*N)},
> when X is an interval, but N is taken from the precomputed parameter
> array, so it will draw one graph per value in the parameter array?

f(X,N) = sin(X*N)
V=[1,2,3,4];
ploth(t=1,2,vector(#V,i,f(t,V[i])))

Cheers,
Bill.