MATLAB Answers

Solve a symbolic equation in more than one variables

조회 수: 4(최근 30일)
Lu Zhao
Lu Zhao 2021년 4월 12일
답변: Chaitanya Mallela 2021년 6월 25일
Hi,
There is an ODE equation in terms of "u(r)". And there are several other variables in the equation, one of them is called "m" which could be zero.
The problem is, the "Solve" command gives me a symbolic solution which is great, but with "m" in the denominator, namely, I cannot substitute m with zero later.
Is there anyway I could rewrite the solution without m in the denominator, or define "m" to be a possible zero value (I tried "assume(m>=0)" and it's not working) ?
Here is the equation:
clc
clear
syms u(r) alpha r m omega Omega U_j0 Uinf R0
syms U W(r)
eqn=diff(u, r, r)*(omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2 == r^2*diff(u, r)*(((2*Omega*R0*(omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2*(2*Omega*R0 - 3*Omega*r - m*omega*r - Omega*R0*m^2 + Omega*m^2*r + U_j0*alpha*m*r))/(r^5*((omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2/r^2 - (2*Omega^2*(R0 - r)*(R0 - 2*r))/r^2)^2) + (Omega*m*(R0 + 2*r)*(omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r))/(r^3*((omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2/r^2 - (2*Omega^2*(R0 - r)*(R0 - 2*r))/r^2)))*((omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2/r^2 - (2*Omega^2*(R0 - r)*(R0 - 2*r))/r^2) - (omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r)^2/r^3 + (Omega*m*(R0 - 2*r)*(omega*r + Omega*R0*m - U_j0*alpha*r - Omega*m*r))/r^3);
sol=dsolve(eqn);
u2_exp=simplify(sol);
I really appreciate your help!
(By the way, since "m" could be any real value for my problem, i.e., -1, 0, 1 , 2 ....., it would be great to get a geneal solutions rather than just defining m = 0. )

답변(1개)

Chaitanya Mallela
Chaitanya Mallela 2021년 6월 25일
If you do not want m to be in the denominator then try giving a non zero value of m as m is present in the denominator it cannot take zero value or consider u2_exp as a symbolic function with m as argument to get general solution.

Community Treasure Hunt

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

Start Hunting!

Translated by