solution for symbolic equation: matlab can't find a solution for my equation

3 次查看(过去 30 天)
i have this equation
J(x) =(4*C*Mo*mom*mom1*mus*sin(o)*(C^2 + 3*x^2))/(l*pi*(C^2 - x^2)^3) - (12*C*Mo*mom*mom1*x*cos(o)*(C^2 - x^2)^3*(C^2 + x^2))/(pi*(C + x)^7*(C - x)^7)==0
x is the only variable and the other parameters are positive real numbers
i try to find a solution for x based on the others parameter (there are many solutions, i found it on paper), but using the command solve i get this
root(3*mus*z^4*sin(o) + 3*l*z^3*cos(o) - 2*C^2*mus*z^2*sin(o) + 3*C^2*l*z*cos(o) - C^4*mus*sin(o), z)
this is the same solution i found on paper and thats how i know there are at least 2 real solutions but the program doesn't go on and don't give me the actual family of solution

回答(1 个)

Paul
Paul 2021-11-27
Use the ReturnConditions option to see all of the solutions
syms x C Mo mom mom1 mus o l
J(x) =(4*C*Mo*mom*mom1*mus*sin(o)*(C^2 + 3*x^2))/(l*sym(pi)*(C^2 - x^2)^3) - (12*C*Mo*mom*mom1*x*cos(o)*(C^2 - x^2)^3*(C^2 + x^2))/(sym(pi)*(C + x)^7*(C - x)^7)==0;
sol = solve(J(x),x,'ReturnConditions',true)
sol = struct with fields:
x: [4×1 sym] parameters: [1×0 sym] conditions: [4×1 sym]
sol.x
ans = 
However, specifying all the parameters as real and positive yields a much different result
syms x C Mo mom mom1 mus o l positive
J(x) =(4*C*Mo*mom*mom1*mus*sin(o)*(C^2 + 3*x^2))/(l*sym(pi)*(C^2 - x^2)^3) - (12*C*Mo*mom*mom1*x*cos(o)*(C^2 - x^2)^3*(C^2 + x^2))/(sym(pi)*(C + x)^7*(C - x)^7)==0;
sol = solve(J(x),x,'ReturnConditions',true)
sol = struct with fields:
x: z1 parameters: z1 conditions: C ~= z1 & mus*sin(o)*C^4 + 2*mus*sin(o)*C^2*z1^2 == 3*l*cos(o)*C^2*z1 + 3*mus*sin(o)*z1^4 + 3*l*cos(o)*z1^3 & ~in(o/pi, 'integer') & 0 < z1
Ignoring analytic constraints leads to something a bit simpler
syms x C Mo mom mom1 mus o l positive
J(x) =(4*C*Mo*mom*mom1*mus*sin(o)*(C^2 + 3*x^2))/(l*sym(pi)*(C^2 - x^2)^3) - (12*C*Mo*mom*mom1*x*cos(o)*(C^2 - x^2)^3*(C^2 + x^2))/(sym(pi)*(C + x)^7*(C - x)^7)==0;
sol = solve(J(x),x,'ReturnConditions',true,'IgnoreAnalyticConstraints',true)
sol = struct with fields:
x: z1 parameters: z1 conditions: 0 < z1 & mus*sin(o)*C^4 + 2*mus*sin(o)*C^2*z1^2 - 3*l*cos(o)*C^2*z1 - 3*mus*sin(o)*z1^4 - 3*l*cos(o)*z1^3 == 0

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

标签

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by