Re: Why these graphs differ?
- To: mathgroup at smc.vnet.net
- Subject: [mg33959] Re: Why these graphs differ?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 24 Apr 2002 01:22:31 -0400 (EDT)
- References: <aa3gm6$80q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Vladimir Bondarenko" <vvb at mail.strace.net> wrote in message news:aa3gm6$80q$1 at smc.vnet.net... > These solutions, naturally, coincide. > > DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 2]] > Evaluate[DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 2]]] > > (2 + z^2)/2 > (2 + z^2)/2 > > > But, surprisingly, the corresponding graphs are not identical: > > Plot[ DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 2]], {z, 0, 1}] > Plot[Evaluate[DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 2]]], {z, 0, 1}] > > > Is it a feature or a problem? > > > Vladimir Bondarenko > Vladimir, With Plot[ DSolve[{y'[z] == z, y[0] == 1}, y[z], z][[1, 1, 2]], {z, 0, 1}] numerical values are successively assigned to z and Mathematica tries to solve; however DSolve cannot work with, for example z=0.5, hence the warning messages that you get. You are in fact plotting z. For example z=.5; DSolve[{y'[z]==z,y[0]==1},y[z],z][[1,1,2]] DSolve::dsvar: 0.5` cannot be used as a variable. 0.5 -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565