0
$\begingroup$

I'm a little confused with how to use the output from DSolve. The following works

s = DSolve[{y'[x] == x, y[0] == 0}, y[x], x];
Plot[y[x] /. s, {x, 1, 10}]

but I don't understand how it works. I am familiar with /. a -> b which will replace a with b, but I don't get what y[x] /. s is doing?

$\endgroup$

1 Answer 1

2
$\begingroup$

Dsolve[], like Solve[] (but unlike Resolve[]) returns replacement rules. You are replacing the value of y[]returned by your solve command

$\endgroup$
2
  • $\begingroup$ Thanks. I see whats going on. I can declare a mapping such as map = {a->b}; then i can use this mapping variable in a any ReplaceAll command i.e a /. map or {a,a} /. map. $\endgroup$ Jan 26, 2013 at 2:10
  • $\begingroup$ @David Yes. Replacement rules (term rewriting) are very important in Mathematica. $\endgroup$ Jan 26, 2013 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.