Here is the sample code (calls to the relevant trig functions are highlighted :
It was adapted from code downloaded from a VB 6 "shareware" website
Variable declarations
Rem Main Loop
For Count = Xst - 2 * MyPi To Xst + 2 * MyPi Step 3
'Step++ = Faster; Step-- = Slower
'
If Option1 = True Or Option3 = True Then
y = -Sin((Count - Xst) / One) * One + Yst
y1 = -Atn((Count - Xst) / One) * One + Yst
Else
y = Atn(Sin(Count + Xst) / One) * One + Yst
y1 = (MSinh((Count + Xst)) / One) * One + Yst ********************************
End If
y2 = -((Count - Xst) / One) ^ 3 * One + Yst
If Option1 = True Or Option2 = True Then
If Count > Xst Then y3 = -Log(Atn(Count - Xst) / One) * One + Yst
Else
If Count > Xst Then y3 = -Log(Tan(Count - Xst) / One) * One + Yst
End If
If Option3 = False Then
y4 = -Cos((Count - Xst) / One) * One + Yst
Else
y4 = (MCosh((Count - Xst)) / One) * One + Yst *********************************
End If
'Draw ...
Picture1.PSet (Count, y), vbBlue ' &HFFFF&
Picture1.PSet (Count, y1), vbGreen ' &H8000&
Picture1.PSet (Count, y2), vbMagenta ' &HC0&
If Count > Xst Then Picture1.PSet (Count, y3), &HFF0000
Picture1.PSet (Count, y4), vbRed ' &HFF&
DoEvents 'Without this line drawing is not interesting!
Next Count
=============================================================================================================
Public Function MSinh(Ival)
Ival = Ival / 16
MSinh = ((2.718 ^ Ival) + (2.718 ^ (Ival * -1)) / 2)
Print #1, "MSinh : " & MSinh & " : " & Ival
End Function
Public Function MCosh(Ival)
Ival = Ival / 16
MCosh = (2.718 ^ Ival) - (2.718 ^ (Ival * -1))
Print #1, "Mcosh : " & MCosh & " : " & Ival
End Function
Public Function Mtanh(Ival)
On Error Resume Next
Dim jx1 As Double, kx1 As Double
jx1 = MCosh(Ival): kx1 = MSinh(Ival)
Mtanh = jx1 / kx1
Ival = Ival / 16
Print #1, "Mtanh : " & Mtanh & " : " & Ival
End Function