[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expm1 & log1p
From: |
Jaroslav Hajek |
Subject: |
Re: expm1 & log1p |
Date: |
Tue, 18 Mar 2008 17:08:16 +0100 |
On Tue, Mar 18, 2008 at 4:26 PM, David Bateman
<address@hidden> wrote:
> David Bateman wrote:
> > Jaroslav Hajek wrote:
> >
> >>> Also the matlab
> >>> functions accept complex arguments whereas your version seems to be
> >>> limited to real arguments
> >>>
> >>>
> >>>
> >> I missed that. Apparently there are only real versions in GNU C
> >> library. I'll try to make
> >> a complex version using the real version.
> >>
> >>
> >>
> >>
> >
> > Complex expm1 (const Complex& x)
> > {
> > double xr = x.real ();
> > Complex xc = Complex (0., x.imag ());
> > return exp (xc) * expm1 (xr);
> > }
> >
> > D.
> >
> >
> >
> Opps
>
>
> Complex expm1 (const Complex& x)
> {
> return ((exp (Complex (0., x.imag ())) + 1.0) * expm1 (x.real ()));
>
>
> }
>
that does not seem to work, I'm afraid.
(exp(i*y)+1) * (exp(x)-1) = exp(x+i*y) -1 + (exp(x)-exp(i*y))
A possible formula is using complex sine
exp(z)-1 = -exp(z/2) * 2*i*sin(i*z/2)
or work the real and imag parts separately
exp(x+i*y)-1 = u+v+u*v + i*sin(y), with
u = exp(x)-1, v = cos(y)-1 = 2*sin(y/2)^2.
I'd say the second option is better.
> D.
>
>
> --
> David Bateman address@hidden
> Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
> Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
> 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
>
> The information contained in this communication has been classified as:
>
> [x] General Business Information
> [ ] Motorola Internal Use Only
> [ ] Motorola Confidential Proprietary
>
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz