nospam>
Wed Oct 26 18:38:03 CDT 2005
Hi Jean-Guy Marcil,
I have figured out what's going wrong. The Microsoft formula is actually
correct. The problem is that cosh must be in the range -1 to 1, as is the
rule with the aCos trig function. In that case, a negative root can never
happen.
--
Stephenc
"Jean-Guy Marcil" wrote:
> stephenc was telling us:
> stephenc nous racontait que :
>
> > the following code fails with "invalid procedure call or argument".
> > Can you see why?
> >
> > Sub test()
> > cosh = 1.5009
> > myAnswer = Atn(-cosh / Sqr(-cosh * cosh + 1)) + 2 * Atn(1)
> > MsgBox myAnswer
> > End Sub
> >
> > It calculates the aCos (inverse cosine) of cosh, and uses the
> > nonintrinsic math formula given in Word 2003 help. cosh is normally
> > variable but 1.509 is typical for it.
>
> Right off the bat, let me state that I am terrible at maths.... but...
> doesn't a negative number divided by another negative number always results
> in a positive number?
>
> Since cosh is positive to start with, why do you make it negative twice?
> Finally, the Sqr function does not work with negative numbers. Indeed, what
> two identical numbers multiplied with each other will result in a negative
> number? Since you need a negative and a positive number to get a negative
> number, you can never have a "negative" power.
> I.e, ( -9 = -3*3 ), but -3 is not equal to 3...
> So, if you modify your formula like this:
> myAnswer = CStr(Atn(cosh / Sqr(cosh * cosh + 1)) + 2 * Atn(1))
> then you should find happiness, no?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site:
http://www.word.mvps.org
>
>
>