Waldek Hebisch <[EMAIL PROTECTED]> writes: > > * the patch by Francois Maltey for asin, acos, etc. > > > > Somebody should check (re-check ?) branch cuts and singularities with this > patch.
(for convenience, I include the patch below) I guess the right place to check branch cuts and singularities is in src/input/elemnum.input. I looked at the common lisp hyperspec, the definition of branchcuts is quite clear there, so I suggest that we take it as definition, unless you have a better reference. Now, how to test the branch cuts? I do not really know, but I guess we have to test both real and complex float and dfloat domains. Eg., the hyperspec for asin, acos, atan says: The following definition for arc sine determines the range and branch cuts: arcsin z = -i log (iz+sqrt(1-z^2)) The branch cut for the arc sine function is in two pieces: one along the negative real axis to the left of -1 (inclusive), continuous with quadrant II, and one along the positive real axis to the right of 1 (inclusive), continuous with quadrant IV. The range is that strip of the complex plane containing numbers whose real part is between -<PI>/2 and <PI>/2. A number with real part equal to -<PI>/2 is in the range if and only if its imaginary part is non-negative; a number with real part equal to <PI>/2 is in the range if and only if its imaginary part is non-positive. so we need to test: real < -1 error > +1 error = -1 -%pi/2 = +1 -%pi/2 complex x + 0*%i, x < -1 close to x + 0.1*%i complex x + 0*%i, x > 1 close to x - 0.1*%i Is this correct? Are there sensible values for x I could check? Martin Index: float.spad.pamphlet =================================================================== --- float.spad.pamphlet (revision 442) +++ float.spad.pamphlet (working copy) @@ -455,7 +455,7 @@ normalize r atanh x == - if x > 1 or x < -1 then error "invalid argument to atanh" + if x >= 1 or x <= -1 then error "invalid argument to atanh" p := min(0,order x) if zero? x or 2*p < -bits() then return x inc(5-p); r := log((x+1)/(1-x))/2; dec(5-p) Index: trigcat.spad.pamphlet =================================================================== --- trigcat.spad.pamphlet (revision 442) +++ trigcat.spad.pamphlet (working copy) @@ -136,7 +136,10 @@ (a := recip x) case "failed" => error "acoth: no reciprocal" atanh(a::$) if $ has Field and $ has sqrt: $ -> $ then - asin x == atan(x/sqrt(1-x**2)) + asin x == + one?(x) => 2*atan 1 + one?(-x) => -2*atan 1 + atan(x/sqrt(1-x**2)) acos x == pi()/2::$ - asin x acot x == pi()/2::$ - atan x asinh x == log(x + sqrt(x**2 + 1)) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to fricas-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en -~----------~----~----~----~------~----~------~--~---