Subject: Graphing a function for several parameter values
From: Patrick Blanchenay
Date: Mon, 13 Feb 2012 17:53:44 +0000
Je la 13/02/2012 17:02, Jaime Villate skribis:
> On 02/13/2012 04:20 PM, Patrick Blanchenay wrote:
>> Do you know if I could apply the substitution of parameters to several
>> functions?
>>
>> E.g. something like:
>>
>> flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p,
>> plist);
>> plot2d ( flist, [x, 0, 7]);
>>
>> I have no idea, but basically i'd like to plot two functions for several
>> parameters values, so I need to have them like
>> [f(under param_set1), g(under param_set1), f(under param_set2), g(under
>> param_set2)]
>>
>> Is this still feasible with makelist?
> Sure, something such as:
>
> flist: makelist ( ev( [f(x,p1,p2), g(x,p1,p2)], p), p, plist)$
> plot2d (flatten (flist), [x, 0, 7]);
>
> That makelist command will create a list of the type [[f1,g1], [f2,g2],...]
> flatten() will transform it into the list that plot2d needs: [f1, g1,
> f2, g2, ...]
>
Ah, flatten is exactly what I needed. Thank you very much for your help!
(And thank you Alexander as well!)