Simplifying solution to algebraic system of equations

1 次查看(过去 30 天)
The following code outputs a value for a and b with respect to the imaginary number i but the output is not fully simplified with the complex and real part separately factored. Is there a way to modify the code so the real and imaginary parts are separate?
syms X Y Q t w v a b z c N theta m L g
eq1 = b-a == 10*(cosd(45)+i*sind(45));
eq2 = 3 == (a-b)/4+a*i/3 + b/(6*i)+b/12;
sol = solve([eq1 eq2], [b a]); %[a b c] = [theta' theta'' x'']
sol_b = simplify(sol.b)
solb = sol.b

采纳的回答

John D'Errico
John D'Errico 2020-4-21
It would be almost as easy to solve by hand.
>> sol = solve(eq1,eq2,[a,b]);
>> real(sol.a)
ans =
8*2^(1/2) + 36/5
>> imag(sol.a)
ans =
4*2^(1/2) - 72/5
b will be similar. The symbolic toolbox chooses to group the sqrt(2) stuff together, but I don't see the problem either way. If I had to guess, look at the expression:
sol.a
ans =
2^(1/2)*(8 + 4i) + 36/5 - 72i/5
Here, we have 8+4i as ONE number. A complex number, yet only one number. Likewise, (36/5 - 72i/5) may be thought of as only one number, not two numbers, just one complex number. So the form returned is actually simpler than what you want to see.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by