Help ! two nonlinear equations

조회 수: 1 (최근 30일)
Muhammed Adel
Muhammed Adel 2016년 4월 21일
댓글: Muhammed Adel 2016년 10월 8일
cos(3x)-cos(3y)+1 =0
cos(5x)-cos(5y)+1 =0
please, i can not answer these two nonlinear equations by matlab .

채택된 답변

John D'Errico
John D'Errico 2016년 4월 21일
Actually, solve has no problems, returning only a set of 6 solutions that all lie in the interval [-pi,pi]. Of course they will not be represented in the form of radicals since those equations are equivalent to a high order (10th degree) polynomial, so vpa is then needed to recover the actual values.
syms x y
xy = solve(cos(3*x)-cos(3*y)+1 ==0,cos(5*x)-cos(5*y)+1 ==0)
xy =
x: [6x1 sym]
y: [6x1 sym]
vpa(xy.x)
ans =
-0.92557695405354896912598298502098
3.1415926535897932384626433832795
0.92557695405354896912598298502098
1.5707963267948966192313216916398
-0.92557695405354896912598298502098
0.92557695405354896912598298502098
Personally, I always like a graphical solution here. One can learn a lot from a picture.
[xx,yy] = meshgrid(linspace(-pi,pi,200));
zz1 = cos(3*xx)-cos(3*yy)+1;
zz2 = cos(5*xx)-cos(5*yy)+1;
contour(xx,yy,zz1,[0 0],'color','r')
hold on
contour(xx,yy,zz2,[0 0],'color','b')
grid on
axis equal
All crossings of the two contour colors are a solution to the nonlinear system. As you can see, there is a nice periodicity to those solutions. There will be infinitely many such solutions of course.

추가 답변 (2개)

Roger Stafford
Roger Stafford 2016년 4월 21일
This doesn't solve your equations, but you can gain a better insight into their nature by expanding the cosine expressions in terms of cos(x) and cos(y). Let s = cos(x) and t = cos(y). Then your equations can be expressed:
(4*s^3-3*s)-(4*t^3-3*t)+1 = 0
(16*s^5-20*s^3+5*s)-(16*t^5-20*t^3+5*t)+1 = 0
There will be only a finite number of solution pairs to these polynomial equations whereas each solution (s,t) will have infinitely many combinations of corresponding x and y values which are also solutions. Changing to s and t avoids this confusing infinitude of solutions. I suspect 'solve' will be unable to obtain a specific solution to the above, so you may have to resort to numerical methods with 'fsolve'.

John BG
John BG 2016년 4월 22일
편집: John BG 2016년 4월 22일
Muhammed
the expression
cos(3*x)-cos(3*y)+1=0
is same as
-2*sin((3*(x+y+x-y))/2)*sin((3*(x+y-(x-y)))/2)=-1
sin(1.5*x)*sin(1.5*y)=.5
the second equation
sin(2.5*x)*sin(2.5*y)=.5
and the solution are the points:
sin(1.5*x)*sin(1.5*y)-sin(2.5*x)*sin(2.5*y)=0
that d'Errico shows in the 2D graph, only the intersections of blue and red circles that are available directly from the contours:
[c1,h1]=contour(xx,yy,zz1,[0 0],'color','r')
[c2,h2]=contour(xx,yy,zz2,[0 0],'color','b')
the points of the circles are
blue circles
ax1=h1.XData
ay1=h1.YData
red circles
ax2=h2.XData
ay2=h2.YData
the solution:
x1=intersect(ax1,ax2)
y1=intersect(ay1,ay2)
only happens when
1.5*M*(x+y)=N*2.5*(x-y)
for any positive or negative integer M N
Mr d'Errico, do you agree?
John
note about trigonometry basics:
  댓글 수: 2
John D'Errico
John D'Errico 2016년 4월 22일
I don't see that the relationship
1.5*M*(x+y)=N*2.5*(x-y)
trivially follows from your derivation, nor is it at all useful in predicting solutions.
Muhammed Adel
Muhammed Adel 2016년 10월 8일
thanks sir

댓글을 달려면 로그인하십시오.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by