All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard B. Kreckel" <kreckel-HEL5OUoDxoc@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andreas Enge <andreas.enge-MZpvjPyXg2s@public.gmane.org>,
	Bill Allombert
	<Bill.Allombert-AE+LCD0i0auq1rftRos53FaPQRlvutdw@public.gmane.org>,
	Karim Belabas
	<Karim.Belabas-AE+LCD0i0auq1rftRos53FaPQRlvutdw@public.gmane.org>
Subject: Wrong formulae for complex elementary functions
Date: Fri, 26 Nov 2010 09:57:27 +0100	[thread overview]
Message-ID: <4CEF7677.30500@ginac.de> (raw)

Hi!

The man pages for cacos, cacosf, cacosl, catan, catanf, catanl, cacosh, 
cacoshf, cacoshl, catanh, catanhf, and catanhl contain wrong maths.

cacos, cacosf, cacosl:
   The formula given in the man page
     cacos(z) = -i clog(z + csqrt(z * z - 1))
   gives wrong results in second and fourth quadrant of complex plain.
   The formula
     cacos(z) = -i clog(z + I*csqrt(1 - z * z))
   gives correct results.

catan, catanf, catanl:
   The formula given in the man page
     catan(z) = 1 / 2i clog((1 + iz) / (1 - iz))
   gives wrong results on the negative imaginary axis beginning at -I
   (along one of the two branch cuts). Besides, the formula is written
   in an ambiguous way.
   The formula
     catan(z) = (clog(1 + iz) - clog(1 - iz)) / 2i
   gives correct results.

cacosh, cacoshf, cacoshl:
   The formula given in the man page
     cacosh(z) = (0.5) * clog((1 + z) / (1 - z))
   gives wrong results everywhere in the complex plain. (The formula
   seems to be copied from the one for catanh, where it is sometimes
   correct.)
   The formula
     cacosh(z) = 2 * clog(csqrt((z + 1)/2) + csqrt((z - 1)/2))
   gives correct results.

catanh, catanhf, catanhl:
   The formula given in the man page
     catanh(z) = 0.5 * clog((1 + z) / (1 - z))
   gives wrong results on the positive real axis beginning at 1 (along
   one of the two branch cuts).
   The formula
     catanh(z) = 0.5 * (clog(1 + z) - clog(1 - z))
   gives correct results.

I've also checked casin, casinf, casinl, casinh, casinhf, and casinhl 
and the formulae given there
     casin(z) = -i clog(iz + csqrt(1 - z * z))
     casinh(z) = clog(z + csqrt(z * z + 1))
are actually correct.

I suspect that some of these errors are due to somebody trying to 
"simplify" these formulae. Since this can ruin the behavior, I recommend 
to add a comment to the upstream sources that warns against attempt of 
simplification.

For the sake of reference, I am looking at manpages-dev 3.25-1 on 
Debian/squeeze.

Bye!
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-11-26  8:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-26  8:57 Richard B. Kreckel [this message]
     [not found] ` <4CEF7677.30500-HEL5OUoDxoc@public.gmane.org>
2010-11-27  7:37   ` Wrong formulae for complex elementary functions Michael Kerrisk
     [not found]     ` <AANLkTinAUyVTdjxY9KVgnOerWxhXtnvmHeTQ-Gb0-TxC-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-05 21:34       ` Richard B. Kreckel
     [not found]         ` <4E3C61FE.1010107-HEL5OUoDxoc@public.gmane.org>
2011-09-15  4:31           ` Michael Kerrisk
     [not found]             ` <CAKgNAkjamtuK95ouh6+zsCS1dHiZO0-1q72GpN0CSaFk9XxWqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-15  8:34               ` Richard B. Kreckel
2011-09-15 18:38               ` Michael Kerrisk
     [not found]                 ` <CAKgNAkiv7-FL95p2D_80EaRTxhbwDOTun7N_uSsPr2e71Cz8EA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-15 21:42                   ` Richard B. Kreckel
     [not found]                     ` <4E727152.2060503-HEL5OUoDxoc@public.gmane.org>
2011-09-16  6:05                       ` Michael Kerrisk
     [not found]                         ` <CAKgNAkgHrLgk+QBs0jnWXavj5PLBPhaLO=33tgQxAwTUyFhzwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-16  9:45                           ` D. Barbier
2011-09-15 16:24           ` Andries E. Brouwer
2011-09-15 18:36             ` Michael Kerrisk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CEF7677.30500@ginac.de \
    --to=kreckel-hel5ouodxoc@public.gmane.org \
    --cc=Bill.Allombert-AE+LCD0i0auq1rftRos53FaPQRlvutdw@public.gmane.org \
    --cc=Karim.Belabas-AE+LCD0i0auq1rftRos53FaPQRlvutdw@public.gmane.org \
    --cc=andreas.enge-MZpvjPyXg2s@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.