For anyone who want to solve a complex equation, which is hard to work out by hands (Like General Equlibrium in Economy) .
First method: Directly
- Define symbols (variables) of the equation:
syms k [more_varibles]
- Define the equation using the above symbols, for example:
eqn = (k^2+k)^2-0.98*(2-k^2)^2*(1+0.5/k) == 0
- Slove out the analytical solutions (解析解) if exits:
S = solve(eqn) % assign the result to S
- If you need a numerical solutions (数值解), draw a picture of the equation first to find out the range of solutions:
% draw in the vicinity of solutions
% range from -4 to 2 (you could try another)
fplot([lhs(eqn) rhs(eqn)], [-4 2])

- Find out the numerical solutions in the certain range we have observered (we assume that k>0):
V = vpasolve(eqn,k,[0,1])
output:
>> V = vpasolve(eqn,k,[0,1])
V =
0.85411502864076704504148852270389
Second method: Multiple equations
TO-DO