I have a lot of old code that uses asin(2) to make a NaN. (Hate to admit it, but there it is... ). This may break a lot of it.
Sent from my iPhone > On Feb 19, 2021, at 6:20 PM, Ed . <[email protected]> wrote: > > > For sqrt with real numbers, there's already multiple possible answers! So > this is not adding any additional problems. > > For log, it’s probably most pragmatic to have an additional function, which > already exists in PDL::Complex. Question: does this new “native” complex > support mean PDL::Complex should change / be simplified? Also, are you saying > that you consider the behaviour of promoting floats/doubles into their > complex counterparts is wrong? > > Best regards, > Ed > > From: Luis Mochan > Sent: 20 February 2021 01:08 > To: [email protected]; perldl > Subject: Re: [Pdl-devel] PDL 2.026_01 released to CPAN > > > Hi Ed, > > I'm not sure about what should be expected for operations on real > numbers that have no real answer: a complex answer or an error? (In the > case of sqrt(-1) or worse, for log(-1) there is the further problem of > multiple possible answers.) > > Consider > > pdl> $i=sequence(long,10); > > pdl> p $i/3 > [0 0 0 1 1 1 2 2 2 3] > > pdl> > > In this case, division is not promoting longs into floats. However > asin(3) does promote floats into complex. sqrt(-1) isn't. So I'm still > confused about what are the appropriate expectations. I'd follow your > suggestion if I were sure what to request. > > Regards, > Luis > > > On Sat, Feb 20, 2021 at 12:52:58AM +0000, Ed . wrote: > > > Is this the expected behavior? > > > > I’d have to say yes – the changes made by Ingo are to use <complex.h>’s > > native-ish C complex-numbers support, and PDL types and code changes to > > support that. The change to asin’s behaviour came for free with that. It’s > > not yet fully pervasive, and I’m not 100% sure whether the new complex > > behaviour should actually change to be opt-in. > > > > On the other hand, making it do the mathematically correct thing all the > > way seems like the correct way forward! If people can try their various > > scripts and extensions and see if anything breaks, and/or find things that > > are not according to their expectations, it would be really helpful to > > report that on here. Luis, could you open an issue on the repo and capture > > at least this sqrt point? (A PR to add a failing test would be even better, > > and a PR with a failing test plus code to fix the problem would be better > > again 😊) > > > > Best regards, > > Ed > > > > From: Luis Mochan<mailto:[email protected]> > > Sent: 20 February 2021 00:09 > > To: > > [email protected]<mailto:[email protected]>; > > perldl<mailto:[email protected]> > > Subject: Re: [Pdl-devel] PDL 2.026_01 released to CPAN > > > > I installed it 026_01 (from github/master) > > > > > > pdl> p asin(3) > > 1.5707963267948966+1.7627471740390861i > > > > pdl> p sin(asin(3)) > > 3.0000000000000004+1.7319121124709863e-16i > > > > Seems good, but > > > > pdl> p sqrt(-1) > > Runtime error: Can't take sqrt of -1 at (eval 400) line 5. > > > > pdl> use PDL::Complex > > > > pdl> p sqrt(-1) > > Runtime error: Can't take sqrt of -1 at (eval 416) line 5. > > > > pdl> p sqrt(-1+0*i) > > 0 +1i > > > > pdl> > > > > Is this the expected behavior? > > > > Regards, > > Luis > > > > > > > > On Fri, Feb 19, 2021 at 05:52:44PM -0600, Luis Mochan wrote: > > > This is good news! > > > Thanks! > > > Luis > > > > > > On Fri, Feb 19, 2021 at 08:15:59PM +0000, Ed . wrote: > > > > Dear PDL users, > > > > > > > > I’ve just uploaded PDL 2.026_01 to CPAN. It has Ingo Schmid’s “native > > > > complex types” code (as tidied up a bit). Please give it a go and > > > > report whether it works! Please note that now e.g. asin(3) will not > > > > return NaN, but instead a complex number (which is, of course, > > > > mathematically valid). > > > > > > > > As Derek said, please report any issues you find to the mailing list > > > > (good), or create an issue (better) or a pull request (best!) on > > > > GitHub. Thanks, and Happy PDL-ing! > > > > > > > > Best regards, > > > > Ed > > > > > > > > > > _______________________________________________ > > > > pdl-devel mailing list > > > > [email protected] > > > > https://lists.sourceforge.net/lists/listinfo/pdl-devel > > > > > > > > > -- > > > > > > o > > > W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) > > > Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ > > > Av. Universidad s/n CP 62210 | (*)/\/ \ > > > Cuernavaca, Morelos, México | [email protected] /\_/\__/ > > > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB > > > > > > > > > _______________________________________________ > > > pdl-devel mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/pdl-devel > > > > -- > > > > o > > W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) > > Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ > > Av. Universidad s/n CP 62210 | (*)/\/ \ > > Cuernavaca, Morelos, México | [email protected] /\_/\__/ > > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB > > > > > > _______________________________________________ > > pdl-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/pdl-devel > > > > -- > > o > W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) > Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ > Av. Universidad s/n CP 62210 | (*)/\/ \ > Cuernavaca, Morelos, México | [email protected] /\_/\__/ > GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB > > > _______________________________________________ > pdl-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pdl-devel > > _______________________________________________ > pdl-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pdl-general
_______________________________________________ pdl-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pdl-general
