Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8426
| From | trayres <trayres@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Using ./ - having trouble understanding why it isn't more like a 'map' function |
| Date | 2012-02-09 10:46 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jh085a$i47$1@smc.vnet.net> (permalink) |
Hi all-
I'm searching through the help for NDSolve, and I run into the following:
Plot[Evaluate[y[x] /. s], {x, 0, 30}, PlotRange -> All]
Also, in the following tutorial on DSolve Plotting:
http://reference.wolfram.com/mathematica/tutorial/DSolvePlottingTheSolution.html
the following occurs:
Plot[Evaluate[y[x] /. sol /. {C[1] -> 1}], {x, -7, 7},
PlotRange -> All]
The trouble is, in the above tutorial I don't understand why you use
y[x] /. sol at all.
Shouldn't this just be replacing y[x] with sol?
If I run 'sol' directly, I get
{{y -> Function[{x},
E^(-(x^2/2)) C[1] +
1/2 E^(-(x^2/2)) Sqrt[\[Pi]/
10] (Sqrt[1 + 2 I] Erfi[Sqrt[1/2 - I] x] +
Sqrt[1 - 2 I] Erfi[Sqrt[1/2 + I] x])]}}
if I run y[x]/.sol, I get:
{E^(-(x^2/2)) C[1] +
1/2 E^(-(x^2/2)) Sqrt[\[Pi]/
10] (Sqrt[1 + 2 I] Erfi[Sqrt[1/2 - I] x] +
Sqrt[1 - 2 I] Erfi[Sqrt[1/2 + I] x])}
Then later, if I see what y[x] is now equal to, I get the same thing
as y[x]/.sol:
{E^(-(x^2/2)) C[1] +
1/2 E^(-(x^2/2)) Sqrt[\[Pi]/
10] (Sqrt[1 + 2 I] Erfi[Sqrt[1/2 - I] x] +
Sqrt[1 - 2 I] Erfi[Sqrt[1/2 + I] x])}
This means that /. isn't replacing in an instance, it's actually
mapping 'f' (the label for the function) with variable 'x' to the
appropriate results of 'sol'.
I don't get why Map isn't used, and I don't get what this /. is really
doing. If someone could give me a better idea, I'd really appreciate
it.
Thanks,
-Travis Ayres
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Using ./ - having trouble understanding why it isn't more like a 'map' function trayres <trayres@gmail.com> - 2012-02-09 10:46 +0000
csiph-web