[Date Index]
[Thread Index]
[Author Index]
Re: Schaums outline Mathematica 2nd ed, prob. 11.3 help
*To*: mathgroup at smc.vnet.net
*Subject*: [mg125743] Re: Schaums outline Mathematica 2nd ed, prob. 11.3 help
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Fri, 30 Mar 2012 04:40:12 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <201203290759.CAA21786@smc.vnet.net>
*Reply-to*: murray at math.umass.edu
This is one of those "kick yourself" situations: you mistyped the input
variable "x" as upper-case "X" in the DSolve expression! If you fix
that, everything will work.
However, the Schaum's Outline code is not very good. Here's a more
direct way to do the same thing, without the very artificial device of
setting up a Do loop, and even without any need to index into s1:
v1 = VectorPlot[{1, x^2 + y}, {x, 0, 1}, {y, 0, 12},
Axes -> Automatic, VectorScale -> Tiny];
s1 = y[x] /.
Table[DSolve[{y'[x] == x^2 + y[x], y[0] == k}, y[x], x], {k, 0, 4}];
Show[{Plot[s1, {x, 0, 1}, PlotStyle -> Thick, PlotRange -> All], v1},
Frame -> True, AspectRatio -> 1]
There I arbitrarily changed the PlotStyle option to make use of symbolic
value Thick.
By default, done this way, the different solution curves will have
different colors. If you want them all the same color, you could change
your PlotStyle option to, e.g.:
PlotStyle -> Directive[Thick, Darker@Blue]
On 3/29/12 3:59 AM, pennsylvaniajake at gmail.com wrote:
> I cannot get this code to show the solutions to the equation, only the vector plot. Whats wrong? It came from Schum's Outline, Mathematica 2n ed, solved problem 11.3 on page 272-3. The only changes I made was using v1 for vf and s1 for solutions.
>
> v1 = VectorPlot[{1, x^2 + y}, {x, 0, 1}, {y, 0, 12},
> Axes -> Automatic, VectorScale -> Tiny];
>
> s1 = Table[
> DSolve[{y'[x] == X^2 + y[x], y[0] == k}, y[x], x], {k, 0, 4}];
>
> Do[g[k] =
> Plot[s1[[k, 1, 1, 2]], {x, 0, 1}, PlotStyle -> Thickness[0.007],
> PlotRange -> All], {k, 1, 5}]
>
> Show[g[1], g[2], g[3], g[4], g[5], v1, Frame -> True,
> AspectRatio -> 1]
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: PC auto-simplifies output, but mac doesn't**
Next by Date:
**Re: PC auto-simplifies output, but mac doesn't**
Previous by thread:
**Re: Schaums outline Mathematica 2nd ed, prob. 11.3 help**
Next by thread:
**Re: Schaums outline Mathematica 2nd ed, prob. 11.3 help**
| |