       Re: Incredible slow Plot

• To: mathgroup at smc.vnet.net
• Subject: [mg120183] Re: Incredible slow Plot
• From: David Bailey <dave at removedbailey.co.uk>
• Date: Tue, 12 Jul 2011 06:58:08 -0400 (EDT)
• References: <iv9etb\$dg1\$1@smc.vnet.net> <ivel3b\$88l\$1@smc.vnet.net>

On 11/07/2011 11:59, Iv=E1n Lazaro wrote:
> Hi!
>
> Yes, I tried
>
>   sol=NDSolve[{eqns, cond},f,{t,0,1200}][];
>   Plot[Evaluate[f[t]/.sol],{t,0,1200}],
>
> but that was a pain. Thanks to Bobby I managed to solve my speed problem:
>
>
> sol=NDSolve[{eqns, cond},f,{t,0,1200}][];
> Plot[Evaluate[f[t]/.sol],{t,0,1200}],
>
> I selected the specific solutions I needed, and Set them to a variable
> that then I plot:
>
>
>
> sol=NDSolve[{eqns, cond},f,{t,0,1200}][];
> a=sol[[1, Something, 2]]
> b=sol[[1, Something+1, 2]]
>
> Plot[{a[t],b[t]}],{t,0,1200}],
>
> and that was it. However I don't understand this. Was the problem the
> "size" and "amount" of interpolated functions?
>
This can only be a guess, because you didn't post a complete example. Go
back to the original, slow example, and create the expression
corresponding to the plot (without plotting it).

pl=Plot[Evaluate[f[t]/.sol],{t,0,1200}];

Does that calculation go reasonably fast - if so, it is the process of
transferring the result to the front end and actually plotting it which
is at fault.

It may now help to reduce the upper limit from 1200  to (say) 10, just
to get a simple expression. Now look at:

pl//InputForm

If this expression contains lots of Line structures, rather than a few
Line Structures containing many coordinate values, then this is the
explanation. Large structures of this sort transfer to the front end
very inefficiently.

If this doesn't work, why not post a complete example of a slow plot.

David Bailey
http://www.dbaileyconsultancy.co.uk

• Prev by Date: Re: Incredible slow Plot
• Next by Date: Re: How to write a "proper" math document
• Previous by thread: Re: Incredible slow Plot
• Next by thread: Re: Incredible slow Plot