Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systematic doctest for function return type #24299

Open
zimmermann6 opened this issue Nov 29, 2017 · 23 comments
Open

Systematic doctest for function return type #24299

zimmermann6 opened this issue Nov 29, 2017 · 23 comments

Comments

@zimmermann6
Copy link

sage: sinh(CIF(1))
[1.1752011936438013 .. 1.1752011936438017]
sage: asinh(CIF(1))
0.881373587019543

The second command should return a (complex) interval.

Also:

sage: asin(CIF(0.6))
...
TypeError: unable to convert '0.59999999999999998?' to a real number

Depends on #24318
Depends on #24329
Depends on #24604

CC: @jdemeyer

Component: symbolics

Author: Ralf Stephan

Branch/Commit: u/rws/24299 @ 0b52ecd

Reviewer: Paul Zimmermann

Issue created by migration from https://trac.sagemath.org/ticket/24299

@rwst
Copy link

rwst commented Nov 30, 2017

comment:2

That's a symbolic function evaluation issue, not the fault of CIF.

@rwst
Copy link

rwst commented Dec 1, 2017

comment:3

As an explanation, the handling of inexact function arguments has several layers. The fallback layer (if the arg has no suitable member function and exact evaluation has no tricks) is to call the helper functions in libs/pynac/pynac.pyx which use member functions of RR and CC. There is in most cases no automatic back-conversion to the argument type so, as fallback, you at least get Real/ComplexField elements.

There is work ongoing in Pynac to use arb instead of RR and CC because of speed and ease of conversion to e.g. interval field elements. It's just that inverse hyperbolic functions are still waiting for it. Of course one could state it's the responsibility of CIF to implement inverse hyperbolic functions (and inverse trig functions, for that matter) but I'm not holding my breath. CIF is a math programming exercise, Pynac tries to solve real calculus problems, so we'll implement it in Pynac-0.7.14.

@rwst

This comment has been minimized.

@rwst rwst changed the title asinh(CIF(1)) returns an element of CC instead of CIF Bugs with inverse trig and hyperbolic functions of CIF argument Dec 2, 2017
@rwst rwst modified the milestones: sage-8.1, sage-8.2 Dec 2, 2017
@rwst
Copy link

rwst commented Dec 4, 2017

Dependencies: #24317

@rwst
Copy link

rwst commented Dec 4, 2017

Changed dependencies from #24317 to #24318, pynac-0.7.14

@rwst
Copy link

rwst commented Dec 26, 2017

@rwst
Copy link

rwst commented Dec 26, 2017

New commits:

0dad6ad24299: Bugs with inverse trig and hyperbolic functions of CIF argument

@rwst
Copy link

rwst commented Dec 26, 2017

Author: Ralf Stephan

@rwst
Copy link

rwst commented Dec 26, 2017

Commit: 0dad6ad

@rwst
Copy link

rwst commented Dec 26, 2017

Changed dependencies from #24318, pynac-0.7.14 to #24318, #24329

@rwst rwst changed the title Bugs with inverse trig and hyperbolic functions of CIF argument Doctest: inverse trig and hyperbolic functions of CIF argument Dec 26, 2017
@zimmermann6
Copy link
Author

comment:9

I'd like to review this, but I see only non-regression tests in commit ​0dad6ad, and no changes in the source code. How could the results change?

@rwst
Copy link

rwst commented Dec 30, 2017

comment:10

Replying to @zimmermann6:

I'd like to review this, but I see only non-regression tests in commit ​0dad6ad, and no changes in the source code. How could the results change?

Functions can be either coded in Python (BuiltinFunction) or C++ (GinacFunction in Pynac). FP evaluation first looks if CIF has a member for asinh and, as there isn't, the function's evalf member is called. As trig and hyperbolic functions are GinacFunctions the changes needed to be done in Pynac, and they became effect with #24329 which was introduced in beta0 I think. So, in order to see the doctests fail you need to go back to 8.1.

@zimmermann6
Copy link
Author

comment:11

I'm not sure about this:

sage: acoth(CIF(0.6))
0.693147180559945?

since we get with CC:

sage: acoth(CC(0.6))
0.693147180559945 - 1.57079632679490*I

@zimmermann6
Copy link
Author

Reviewer: Paul Zimmermann

@rwst
Copy link

rwst commented Dec 31, 2017

comment:12

Agreed, still buggy.

@rwst
Copy link

rwst commented Jan 28, 2018

comment:13

I did a systematic search and found these additional issues:

sage: log_gamma(complex(1.7))
-0.09580769740706588
sage: psi(complex(1.7))
0.2085478748734939

Also dickman_rho can't handle anything other than float.

The code I used will go into tests/symbolic-functions.py.

@rwst
Copy link

rwst commented Jan 29, 2018

@rwst
Copy link

rwst commented Jan 29, 2018

Changed commit from 0dad6ad to 0b52ecd

@rwst
Copy link

rwst commented Jan 29, 2018

New commits:

0b52ecd24299: Systematic doctest for function return type

@rwst
Copy link

rwst commented Jan 29, 2018

Changed dependencies from #24318, #24329 to #24318, #24329, #24604

@rwst rwst changed the title Doctest: inverse trig and hyperbolic functions of CIF argument Systematic doctest for function return type Jan 29, 2018
@rwst
Copy link

rwst commented Feb 1, 2018

comment:16

Replying to @zimmermann6:

I'm not sure about this:

sage: acoth(CIF(0.6))
0.693147180559945?

This one is now fixed in Pynac-0.7.16.

@rwst
Copy link

rwst commented Feb 19, 2018

comment:17

Now with Pynac-0.7.16 still failing.

@rwst
Copy link

rwst commented Jul 1, 2018

comment:18

Update: the correct arccoth(RR(0.7))-->CC, elliptic_eu(7,CC(1.7)), jacobi_am(7,CC(1.7)) are flagged wrong. Still failing: dickman_rho(all types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants