Solving symbolic trig equation

조회 수: 2 (최근 30일)
Tony Yu
Tony Yu 2020년 7월 7일
편집: John D'Errico 2020년 7월 7일
Trying to see how I can solve this equations:
clc
clear all
syms x y z
eq1= -sin(x+y)+cos(x+y-1.6)== 0
eq2= cos(x+y)+cos(x+y-3.2)== 0
solve(eq1,eq2,x,y)

채택된 답변

John D'Errico
John D'Errico 2020년 7월 7일
편집: John D'Errico 2020년 7월 7일
You can NEVER solve for those variables, at least as the equations are written.
First of all, z never even appears. But since you never try to solve for it, who cares?
But look at x + y. They always appear tegether, in EXACTLY the same way. In fact, we can transform the problem in a very simple way, by replacing (x+y) with z.
Now your problem reduces to:
syms z
eq1 = -sin(z)+cos(z-1.6)== 0
eq2 = cos(z)+cos(z-3.2)== 0
There is no more and no less information content in the problem. Surely you can agree, since x+y ALWAYS appear in exactly the same place, and always together.
solve(eq1,z)
ans =
pi/4 + 4/5
solve(eq2,z)
ans =
-log(-exp(8i/5)*1i)*1i
-log(exp(8i/5)*1i)*1i
vpa(ans)
ans =
0.029203673205103380768678308360249
-3.1123889803846898576939650749193
Solving eq1 for z, we find a simple solution. Solving eq2 for z, however, we get a completely different value for z. It is not really imaginary when we resolve it into a simpler numeric form. But see that it is not the first value we got for z.
So nothing in the universe will ever allow a solution to both equations for z, and therefore solving for x and y is just as impossible. It is very easy to write equations that have no solution. Surprise! You just did it.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by