PDA

View Full Version : Maclaurin Series

brownkid3
06-25-2015, 08:45 PM
I am trying to create the Maclaurin series of the inverse of hyerbolic tan in Vba.

the series is stated as

〖tanh〗^(-1) (x)=∑_(n=1)^∞▒1/(2n-1) x^(2n-1)

paulked
06-26-2015, 04:49 AM
Don't know what your question is, but I found http://enu.kz/repository/2010/AIAA-2010-1360.pdf very interesting.

Paul_Hossler
06-26-2015, 08:13 AM
Math is a little fuzzy but this seems to work

Option Explicit
Function InverseTanH(Z As Double, Optional Epilson As Double = 10 ^ -12) As Variant
Dim n As Long
Dim dNextTerm As Double, dTanHWorking As Double

For n = 1 To 100
dNextTerm = (Z ^ (2 * n - 1)) / (2 * n - 1)
If Abs(dNextTerm) < Epilson Then
Exit For
Else
dTanHWorking = dTanHWorking + dNextTerm
End If
Next n
InverseTanH = dTanHWorking
End Function

Kenneth Hobs
06-26-2015, 10:41 AM
You could use WorksheetFunction.ATanH().

Paul_Hossler
06-26-2015, 01:44 PM
You could use WorksheetFunction.ATanH().

Yea, but what fun would that be?? :devil2: