Re: problems with DSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg99423] Re: [mg99375] problems with DSolve
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 5 May 2009 05:43:52 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Read the documentation for Plot and look at the numerous examples that use Evaluate.
Plot[Evaluate[x[t] /. DSolve[
{x'[t] == y[t], y'[t] == -x[t], x[0] == 1, y[0] == 2},
{x, y}, t]], {t, 0, 5}]
Bob Hanlon
---- szymon.stoma at gmail.com wrote:
=============
hello,
i am new to mathematica, therefore sorry if my question is trivial. I
would like to understand why the following line does not work:
Plot[(x[t] /. DSolve[{x'[t] == y[t], y'[t] == -x[t], x[0] == 1, y[0]
== 2}, {x, y}, t]), {t, 0, 5}]
whereas after splitting into two lines it works:
sol = DSolve[{x'[t] == y[t], y'[t] == -x[t], x[0] == 1, y[0] == 2},
{x, y}, t]
Plot[(x[t] /. sol), {t, 0, 5}]
i would like to use Manipulate to play with boundary conditions, so
the first notation would be highly useful.
thanks a lot for any feedback.