Re: need help with Plot

• To: mathgroup at smc.vnet.net
• Subject: [mg88029] Re: need help with Plot
• From: dh <dh at metrohm.ch>
• Date: Tue, 22 Apr 2008 06:28:31 -0400 (EDT)
• References: <fuin33\$9oh\$1@smc.vnet.net>

```
Hi,

Plot can not deal with a varying number of functions. But as a work

around you may define new functions that are zero where you do not want

them to draw. As dirty trick, you may instead of returning zero, you may

return a symbol. In version 6, this has the effect, that this part is

not drawn.

Here an example with zero:

sol=4 t{Sin[2Pi t],1.2 Sin[  2.2 Pi t],1.4Sin[ 2.4Pi t], Sin[2.6Pi t]};

{sol1[t_],sol2[t_],sol3[t_],sol4[t_]}=If[#<t,0,#]&/@sol

Plot[{sol1[t],sol2[t],sol3[t],sol4[t]},{t,0,5}]

Here an example with a symbol (NA):

sol=4 t{Sin[2Pi t],1.2 Sin[  2.2 Pi t],1.4Sin[ 2.4Pi t], Sin[2.6Pi t]};

{sol1[t_],sol2[t_],sol3[t_],sol4[t_]}=If[#<t,NA,#]&/@sol

Plot[{sol1[t],sol2[t],sol3[t],sol4[t]},{t,0,5}]

hope this helps, Daniel

noravanq wrote:

> Hi,

>

> I have the following situation.

>

> f[z_,t_]=some function

> sol=Solve[f[z,t]==0,{z}]

> This returns

> {{z->sol1[t]},{z->sol2[t]},{z->sol3[t]},{z->sol4[t]}}

> I want to plot

> Plot[Select[{sol1[t],sol2[t],sol3[t],sol4[t]},#>t&]

> But it doesn't plot correctly. Depending on t, Select returns either 2 or 4 values. Plot correctly plots only the sections for which Select returns 2 values (it plots two curves), and doesn't plot anything for the interval for t, in which Select returns 4 values.

> Can anyone help to fix this?

>

> I should also mention, that if I restrict t to only the interval where Select returns 4 values, Plot correctly plots 4 curves.

>