# How to solve a system of trig. equation using Mathcad v14

Discussion in 'Math' started by leoxdragon, Jun 3, 2009.

1. ### leoxdragon Thread Starter New Member

Apr 2, 2009
8
0
Hi everybody, I have a system of trig. equation as follow:
cos(α1)-cos(α2)+cos(α3)=3/4
cos(5α1)-cos(5α2)+cos(5α3)=1/2
cos(7α1)-cos(7α2)+cos(7α3)=1/2

I need to solve α1, α2, α3 to eliminate the odd harmonics and my professor introduce me to use Mathcad v14, but i still unable to find its root.
Does anyone know it? pls help me. Thank you very much!

2. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
515
Welcome to AAc

You solve these in Mathcad the same way you do in handraulic, by transformation of variables.

1) obtain expressions for cos 5a1 etc in terms of cosa1 etc by reduction formulae (I think these are in mcad)

cos(na) = cos^n(a) - [n\2]cos^{n-2}(a) sin^2(a) + [n\4]cos^{n-4}(a) sin^4(a) -/+...

where [n\2] and [n\4] etc are binomial coefficients.

2) Let K= cosa1, L=cosa2, M=cosa3

3) substitute for cosa1 etc to obtain 3 equations in K,L M

4) solve these equations for K,L,M

5) back substitute to find a1 etc.

3. ### leoxdragon Thread Starter New Member

Apr 2, 2009
8
0
I think the way you have shown me seems useful to solve this system, However I think it's seems hard to solve another system, for example, the order of harmonics is 7, 9, 11, 13 instead. I mean I'm finding the way to solve it for more complex situations by means of using Mathcad v14. I try to solve it by the way:

given
cos(α1)-cos(α2)+cos(α3)=3/4
cos(5α1)-cos(5α2)+cos(5α3)=1/2
cos(7α1)-cos(7α2)+cos(7α3)=1/2

find(α1,α2,α3) ->
However, I get the wrong result. Maybe I am wrong in the last statement. I also check the instruction but still be unable to solve it
Can you or anyone else show me what is its correct statement? T.T

Last edited: Jun 3, 2009
4. ### Ratch New Member

Mar 20, 2007
1,068
3
leoxdragon,

Too bad your professor does not use Maple. Then you would easily get the following:

cos(alpha1)-cos(alpha2)+cos(alpha3) = 3/4;
cos(5*alpha1)-cos(5*alpha2)+cos(5*alpha3) = 1/2;
cos(7*alpha1)-cos(7*alpha2)+cos(7*alpha3) = 1/2;

fsolve([cos(alpha1)-cos(alpha2)+cos(alpha3) = 3/4, cos(5*alpha1)-cos(5*alpha2)+cos(5*alpha3) = 1/2, cos(7*alpha1)-cos(7*alpha2)+cos(7*alpha3) = 1/2]);

alpha1 = -17.91504991, alpha2 = 10.75802240, alpha3 = 7.933605524

Ratch

5. ### leoxdragon Thread Starter New Member

Apr 2, 2009
8
0
I see your solution using Maple...it's amazing and short. But your result seems not good enough. When I replace alpha 1 , 2, 3 with your result, for example, in the 1st equation, the right side is more than 0.95. It's too far from 0.75 in the equation. I get the familiar result in equation 2 and 3. So, can you tell me the right way?
Additionally, i can't solve the system by your way (using fsolve(fcn1,fc2,fc3) I only get the result if the statement is fsolve(fcn1);
I'm using Maple 7, is the version too old?
anyway, thanks for your help

6. ### Ratch New Member

Mar 20, 2007
1,068
3
leoxdragon,

I think you made a mistake when substituting the values for the first equation. I checked all three equations before I submitted the answers. The first equation gives a value of 0.750000007225 . Hopefully you are using the radian form of the cos.

Ratch

7. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
515
Ratch, an aside question if you will.

Are you able to paste formulae from Matlab into the forum?

8. ### Ratch New Member

Mar 20, 2007
1,068
3
studiot,

I don't have or use MATLAB. As I said to leoxdragon, I use MAPLE. It seems take care of my calculation needs. I just copy, paste, and edit a little to take care of loose ends. http://www.maplesoft.com/

Ratch

9. ### studiot AAC Fanatic!

Nov 9, 2007
5,005
515
Maple, yes I should have read it properly.

Thanks for the reply.

You can see from the clumsy presentation of my formula in post#2 why I am looking for some reasonable way to insert formulae into posts. I know that it copy/paste does not work with Word or Mathcad. And I can't get TEX to work properly for many of the things I want to do.

10. ### leoxdragon Thread Starter New Member

Apr 2, 2009
8
0
yeah, I'm starting to study Maple...it seems not so hard to learn, and yup, I can copy and paste something from or into Maple...it's a good characteristic. However, i find it hard to calculate the trig function such as sin45 or tan135...maybe my Maple version are too low (v7). I'm downloading Maple 13
Anyway, thanks for your help, Mr Studiot and Mr Ratch

11. ### Ratch New Member

Mar 20, 2007
1,068
3
leoxdragon,

See the attached zipped rich text file below (RTF). RTF an be exported from MAPLE.

Ratch

File size:
30.3 KB
Views:
30
12. ### leoxdragon Thread Starter New Member

Apr 2, 2009
8
0
Thanks for your help, Ratch. However, I have to ask you for your advice again. Let's see, i solve the system the same way, and of course, i have the same result:
{alpha1 = -17.91504991, alpha2 = 10.75802240, alpha3 = 7.933605524}
However, I want the result to has the value in [0,pi], so I try to change the formula:
0 <= alpha1 and alpha1 <= alpha2 and alpha2 <= alpha3 and alpha3 <= pi; cos(alpha1)-cos(alpha2)+cos(alpha3) = 3/4; cos(5*alpha1)-cos(5*alpha2)+cos(5*alpha3) = 1/2; cos(7*alpha1)-cos(7*alpha2)+cos(7*alpha3) = 1/2; fsolve([cos(alpha1)-cos(alpha2)+cos(alpha3) = 3/4, cos(5*alpha1)-cos(5*alpha2)+cos(5*alpha3) = 1/2, cos(7*alpha1)-cos(7*alpha2)+cos(7*alpha3) = 1/2]);
I still get unchanged result: {alpha1 = -17.91504991, alpha2 = 10.75802240, alpha3 = 7.933605524}

Could you tell me the way to solve the system with the result has the value of [0, pi] ( a half of the period )

13. ### Ratch New Member

Mar 20, 2007
1,068
3
leoxdragon,

Why sure, it's easy! Add or subtract 2*Pi to the alpha values until they are within the range of [0,Pi] or [0,-Pi] . In other words, unwind the function. Remember that cos(-alpha) = cos(alpha). Applying this method to the alpha values we get alpha1 = .93450601158, alpha2 = 1.80834821436, alpha3 = 1.65042021682 . All the alpha values now are greater than zero, less than PI, and satisify the equations.

Ratch