Unable to find symbolic solution with "dsolve" function

I've used the dsolve() function before, but for some reason it isn't working well for me on this particular problem. The differential equation is dy/dt=(t-e^(-t))/(y+e^y), with an initial value of y(1.5)=0.5.
sol=dsolve('Dy=(t-exp(-t))/(y+(exp(y)))','y(1.5)=0.5','t')
These are the warnings I get:
In dsolve (line 126)
Warning: Unable to find symbolic solution.
> In dsolve>assignOutputs (line 242)
In dsolve (line 228)
and "sol" gets [empty sym], when it should get me an equation.

11 件のコメント

VBBV
VBBV 2020 年 10 月 10 日
編集済み: Walter Roberson 2020 年 10 月 13 日
Define t as symbolic variable
syms y t
eqn = diff(y,t) == t-exp(-t)/(y+exp(y));
Cond = y(1.5)==0.5
S= dsolve(eqn,Cond);
Walter Roberson
Walter Roberson 2020 年 10 月 10 日
unfortunately that does not solve the problem
Lucas Howarth
Lucas Howarth 2020 年 10 月 10 日
What do I do then??
VBBV
VBBV 2020 年 10 月 10 日
install symbolic math toolbox and run it
Lucas Howarth
Lucas Howarth 2020 年 10 月 10 日
Is there not another simpler way? This is only my class's 3rd MATLAB assignment, and I don't think we need to install additional things.
Lucas Howarth
Lucas Howarth 2020 年 10 月 10 日
I think it has to do with the "exp(y)" in the denominator. I can dsolve() the equation fine if I take that out. Maybe it has to do with the domain/range??
VBBV
VBBV 2020 年 10 月 10 日
or use ode45
syms y t
eqn = @(y,t) t-exp(-t)/(y+exp(y));
y0 = 0.5;
span = [0 1];
[t y] = ode45(eqn,span,y0)
Lucas Howarth
Lucas Howarth 2020 年 10 月 10 日
Yeah I actually use ode45 earlier in my code, but my teacher wants us to also plot the real solution that we get using dsolve().
Walter Roberson
Walter Roberson 2020 年 10 月 10 日
dsolve() is the symbolic toolbox. If you are being asked to use dsolve() then you are being asked to use the symbolic toolbox.
Bhomik Kankaria
Bhomik Kankaria 2020 年 10 月 13 日
Hi Lucas,
If dsolve cannot find an explicit solution of a differential equation analytically, then it returns an empty symbolic array. You can solve the differential equation by using MATLAB® numerical solver, such as ode45. For more information, see Solve a Second-Order Differential Equation Numerically.
Alternatively, you can try finding an implicit solution of the differential equation by specifying the 'Implicit' option to true.For example, in your case you can use it to solve the equation -
>> dsolve('Dy=(t-exp(-t))/(y+(exp(y)))','y(1.5)=0.5','t','Implicit',true)
Walter Roberson
Walter Roberson 2020 年 10 月 13 日
By the way, Maple is not able to solve the equation.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

リリース

R2020a

質問済み:

2020 年 10 月 9 日

コメント済み:

2020 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by