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

3 views (last 30 days)
Antonio Benigni
Antonio Benigni on 27 Nov 2021
Commented: Walter Roberson on 30 Nov 2021
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

Answers (1)

Paul
Paul on 27 Nov 2021
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

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!