tags:

views:

86

answers:

3

Hey, I have this little equation that I am trying to solve on Mathematica, but for some reason I cannot get it to work. Any help would be appreciated. Thanks

f[x_, t_] = x^2 - x^3;

eso = x[t] /. DSolve[{[t] == f[x_, t_], x[0] == 0.2}, x, t]

I tried this next, but I keep getting an error

f[x_, t_] = x[t]^2 - x[t]^3;

eso = x[t] /. DSolve[{x'[t] == f[x_, t_], x[0] == 0.2}, x, t]
+3  A: 

What equation are you trying to solve? The above doesn't really make sense, DSolve is for differential equations, also [t] doesn't have meaning. When you define f[x,t] you need to use x[t]^2 and x[t]^3 if x is a function of t.

Adam S.
im trying to solve for f(x,y) see above please
Jonathan
+1  A: 

Mathematica can solve the DE

f[x_]:=x^2-x^3;

DSolve[{x'[t]==f[x[t]]},x,t]

But only in an implicit form. The error message comes from the routine that tries to solve the implicit solution for x[t].

For a quick look at the resulting function, you can try Wolfram alpha.

Simon
The link I posted doesn't seem to work (is it waiting to be moderated?)
Simon
I tried changing it to use markdown, but that didn't work either, so I suspect you're right.
Lawrence Johnston
A: 

Your second attempt approaches being correct in that you specify both sides of the equation, unlike in your first attempt. However, it fails because the second side is not written correctly. Using FullForm you can see that Mathematica interprets x_ and t_ as patterns, not variables. So, instead write:

eso = x[t] /. DSolve[{x'[t] == f[x, t], x[0] == 0.2}, x, t]

where both x and t will now be correctly viewed as variables. If you are using a recent version of Mathematica, they will now change color to reflect this interpretation.

rcollyer