12 views (last 30 days)

Show older comments

I have written the code as below for the equation :

on MATLAB command window,

syms y(t); eqn = diff(y,t) == t^2/(1+y^2);

s=dsolve(eqn)

Warning: Unable to find symbolic solution.

> In dsolve>assignOutputs (line 242)

In dsolve (line 228)

s =

[ empty sym ]

I am not sure what mistake I've done here.

In the question it says

Observe that MATLAB finds three rather complicated explicit solutions. Note that two of them are complex-valued. Select the real one.

In fact, for this solution it is easier to work with an implicit form; so here are instructions for converting your solution. Substitute u = t3 (or t = u(1/3) to generate an expression in u. Set it equal to y and solve for u. Replace u by t3 to get an implicit solution of the form f(t, y) = c.

Would anyone be able to explain this to me, Please?

Wan Ji
on 25 Aug 2021

Hi,

That means

There is no symbolic solution for the differential equation you give.

Wan Ji
on 25 Aug 2021

John D'Errico
on 25 Aug 2021

Edited: John D'Errico
on 25 Aug 2021

Oh well. My fault, as i saw this question posted just before I went to bed last night. No rest for the weary. :) But we can at least come close to solving this problem, once we see the problem is a separable one. That is, multiply by 1+y^2.

Now you have the problem

(1+y^2)*dy = t^2*dt

Integrating both sides, we will see:

y + y^3/3 = t^3/3 + C

So an unknown constant of integration. If we had been given an initial value for the ODE, we could now solve for the constant of integration, C. But lacking that, it is an unknown. We can make things look a little simpler by rearranging, and multiply by 3.

y^3 + 3*y - t^3 + C = 0

C is different here, but still completely unknown, so that is irrelevant.

For example, had you told us that y(0) was 1, then we could solve for C as -4, simply by substitution.

Anyway, now solve for y. This is a cubic polynomial problem in y, so there must be three solutions, 0 or 2 of which in general will be complex valued since the coefficients are real valued.

syms y C t

ysol = solve(y^3 + 3*y - t^3 + C == 0,y,'maxdegree',3)

So three solutions. The problem is, depending on the initial condition, C might take on virtually any value. And that means it almost looks like we are stuck at this point. But then look more carefully at sigma1. What is inside the outer set of parens is always real, although it may be positive or negative. So if we select the real cube root of that number, then sigma1 will always be real. And that means the first solution is the one we need.

Surprisingly, dsolve did not find this solution. But that does not mean it did not exist. So can we nudge dsolve to find that solution? Yes. If you read the help for dsolve, it has an implicit flag.

syms y(t)

ysol = dsolve(diff(y,t) == t^2/(1+y^2),'implicit',true)

Ah. That looks exactly like what I did before by hand. Sorry, but I was not going to write this last night, half asleep.

Wan Ji
on 25 Aug 2021

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!