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

doctesting of sage/interfaces/r.py prints some warnings #31300

Closed
DaveWitteMorris opened this issue Jan 29, 2021 · 2 comments
Closed

doctesting of sage/interfaces/r.py prints some warnings #31300

DaveWitteMorris opened this issue Jan 29, 2021 · 2 comments

Comments

@DaveWitteMorris
Copy link
Member

As pointed out by gh-kliem in ticket #29967, doctesting the interface to R yields some warnings, even though all tests pass:

~/sage % ./sage -t src/sage/interfaces/r.py
Running doctests with ID 2021-01-28-19-03-19-0ac9e573.
Git branch: develop
Using --optional=build,dochtml,homebrew,pip,sage,sage_spkg
Doctesting 1 file.
R[write to console]: Warning messages:

R[write to console]: 1: 
R[write to console]: In sage10 + sage6 :
R[write to console]: 
 
R[write to console]:  longer object length is not a multiple of shorter object length

R[write to console]: 2: 
R[write to console]: In sqrt(sage10) :
R[write to console]:  NaNs produced

R[write to console]: 3: 
R[write to console]: In sqrt(sage4) :
R[write to console]:  NaNs produced

sage -t --warn-long 42.2 --random-seed=0 src/sage/interfaces/r.py
    [257 tests, 3.17 s]
----------------------------------------------------------------------
All tests passed!

Perhaps a user of R can say whether these warnings are revealing anything that needs to be fixed.

(These warnings were reported with --random-seed=151058820726654196682836430928254760259, but I get them even without specifying a seed.)

Component: interfaces

Keywords: R, statistics

Reviewer: Dave Morris

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

@DaveWitteMorris DaveWitteMorris added this to the sage-9.4 milestone Jan 29, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@DaveWitteMorris
Copy link
Member Author

Reviewer: Dave Morris

@DaveWitteMorris
Copy link
Member Author

comment:4

The warnings are expected, so there is no problem here, so this ticket should be closed as invalid.

  1. The doctest is:
The following command generates a new vector `v` of length 11 constructed
by adding together (element by element) `2x` repeated 2.2 times, `y`
repeated just once, and 1 repeated 11 times::

    sage: v = 2*x+y+1; v  # optional - rpy2
    [1] 32.2 17.8 10.3 20.2 66.1 21.8 22.6 12.8 16.9 50.8 43.5

This is intentionally adding two vectors whose lengths are not multiples of each other: the length of 2*x is 5, and the length of y is 11.

2 and 3) The doctests are:

    sage: r(-17).sqrt()  # optional - rpy2
    [1] NaN

The conversion can handle "not a number", infintiy, imaginary values and
missing values:

    sage: r(-17).sqrt().sage()  # optional - rpy2
    nan

Both are intentionally creating a NaN value by taking the square root of a negative number.

Related ticket: #34134 (typo "infintiy" in docstring of r interface)

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

2 participants