Make your own free website on Tripod.com

Trigonometric Equation

 

High school students usually find it tough to solve trigonometric equations because it involves many kinds of formulae. However, I think VB can help students to solve those equations without much problems. I have just created one VB program that can solve the trigonometric equations that take the form  a cos q + b sinq =c.       

 

Private Sub Command1_Click()
Dim a, b, c, x, u1, u2, w1, w2 As Double
a = Val(Txt_a.Text)
b = Val(Txt_b.Text)
c = Val(Txt_c.Text)
x = Atn(b / a)
u1 = ArcCos(c / Sqr(a ^ 2 + b ^ 2)) + x
u2 = (2 * 3.14159265358979 - ArcCos(c / Sqr(a ^ 2 + b ^ 2))) + x
w1 = (u1 / 3.14159265358979) * 180
w2 = (u2 / 3.14159265358979) * 180
If w2 > 360 Then
w2 = w2 - 360
End If
Lbl_Answer1.Caption = Round(w1, 2)
Lbl_Answer2.Caption = Round(w2, 2)
End Sub

Public Function ArcCos(y As Double)
ArcCos = Atn(-y / Sqr(-y * y + 1)) + 2 * Atn(1)
End Function
 

Private Sub Command2_Click()
Txt_a.Text = ""
Txt_b.Text = ""
Txt_c.Text = ""
Lbl_Answer1.Caption = ""
Lbl_Answer2.Caption = ""
End Sub

 

 

 

Explantion

There is no built-in function for Arc Cosine but there is one such function for Arc Tangent

i.e  Atn. However, we can create one function for ArcCos using the formula

          ArcCos = Atn(-y / Sqr(-y * y + 1)) + 2 * Atn(1)

which is derived from Pythagoras Theorem using a right-angled triangle.

 

 

  

 

 

 

 

 

 [Back to VBToday]