1

I'm having trouble understanding this Mathematica syntax.

if I do

y[x] /. DSolve[{y'[x] == y[x], y[0] == 1}, y[x], x]

I'd expect that I now have a function $y(x) = e^x$, such that when I write

y[0] or even N[y[0]] that I should get 1, but Mathematica won't evaluate it and instead writes y[0]

Why? And how can I create a real mathematica function y[x] = e^x from the DSolve Function

Xaser
  • 155
  • 6

1 Answers1

1
 In[1]:= y1[x_] = 
 y[x] /. First[DSolve[{y'[x] == y[x], y[0] == 1}, y[x], x]]

Out[1]= E^x

In[2]:= y1[0]

Out[2]= 1
Lotus
  • 2,671
  • 11
  • 10
  • No its not different. I finished typing it in and then saw your comment :) I can remove it if you want. – Lotus May 17 '17 at 16:39
  • This works. I couldn't get @zhk 's comment to work, however I guess that's just due to my incompetence. I think however that Lotus was first, just took more time to write the answer down, so he gets the accepted answer. – Xaser May 17 '17 at 16:42