开发者

How can we use previously stored symbolic expression in the dsolve command without cut and paste

开发者 https://www.devze.com 2023-01-08 13:14 出处:网络
Hallo,friends we have the following problem syms t u0 u1 u0=sin(t); R1= diff(u0,\'t\',2)+u0-u0^3; u1=dsolve(\'D2u1+u1=R1\',\'t\')

Hallo,friends we have the following problem

syms t u0 u1

u0=sin(t);

R1= diff(u0,'t',2)+u0-u0^3;

u1=dsolve('D2u1+u1=R1','t')

gives the ans
u1=R1+c1*sin(t)+c2*cos(t).

But it does not use the value of R1.开发者_Python百科 How can we do this.Please,tell me.

Thanks in advance


You can use subs(u1, 'R1', R1) to perform the substitution.


Sorry for inconvenience. I got answer to my question:

syms t u0 u1

u0=sin(t);

R1= diff(u0,'t',2)+u0-u0^3;

eq1=strcat('D2u1+u1=',char(R1));

u1=dsolve(eq1,'t')

will return the answer using the value of R1.

0

精彩评论

暂无评论...
验证码 换一张
取 消