Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Why these graphs differ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33972] Re: [mg33942] Re: Why these graphs differ?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 25 Apr 2002 02:59:42 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <000f01c1eb60$26c6e000$03f5b4d0@HolyCow>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

DrBob wrote:
> 
> Jens Wrote:
> >>The Part[expr,1,1,2] is z for expr:> DSolve[{y'[z] == z, y[0] == 1},
> y[z], z]
> 
> >>and the Part[expr,1,1,2] is (2+z^2)/2 for expr:>  {{y[z] -> (2
> +z^2)/2}}
> 
> No, that's not the problem. 

That is the problem !

> The two expressions (including Part)
> evaluate to precisely the same thing.


Because the expressions are not evaluated. So you have
in the first case

Part[DSolve[{y'[z] == z, y[0] == 1},y[z],z],1,1,2]

that gives z

and in the second case

Part[{{y[z] -> (2+z^2)/2}},1,1,2]

that gives (2+z^2)/2


>  The problem is that the first
> expression isn't an explicit function of z, to match the Plot iterator,

Both expressions match the Plot[] iterator -- otherwise
*nothing* would be drawn as for

Plot[DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 1]], {z, 0, 1}]

> until it's evaluated --- and Plot holds the first argument unevaluated
> until a specific iterator value is assigned.

For a numeric z, DSolve[] can't evaluate it's argument, so
DSolve[] return unevaluated  as
DSolve[{y'[0] == 0, y[0] == 1},y[0],0]
and Part[] take the 0 from this expression and draw the
function z.

That shows again how dangerous it is to use Part[] explicit.

Plot[y[z] /. DSolve[{y'[z] == z, y[0] == 1}, y[z], z], {z, 0, 1}]

would create error messages from Plot[] *and* show that there is
something
wrong with the Plot[] argument while

Plot[Part[DSolve[{y'[z] == z, y[0] == 1},y[z],z],1,1,2],{z, 0, 1}]

draw a false result and does not generate error messages from Plot[].


Regards
  Jens


  • Prev by Date: Re: invisible graphics
  • Next by Date: Re: How to change time stepsize for Integration
  • Previous by thread: RE: Re: Why these graphs differ?
  • Next by thread: recognizing integer numbers