Opened 11 years ago

Last modified 9 years ago

#10111 closed enhancement

random_prime is badly documented. — at Version 5

Reported by: drkirkby Owned by: mvngu
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: documentation Keywords:
Cc: fwclarke, burcin Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by fwclarke)

The random_prime() function in Sage can take one, two or three arguments. But all the examples shown in the documentation or random_prime use only one argument. The more complex cases are not documented and not tested.

See also

These are the examples given.

        sage: random_prime(100000)
        sage: random_prime(2)

Although some with good Python knowledge may argue the behavior with 2 or 3 arguments is documented properly, I personally think it could be clearer.

For example, I'm told:


would normally be written as

random_prime(123, proof=False)

It would be good with someone with decent Python knowledge to write some examples of using this function with 2 or 3 arguments.

See also #10112, where it is shown that the function hangs for certain erroneous inputs.

It should also be noted that the error message "n must be greater than lbound " is incorrect, and should be changed to "n must be at least lbound"

Fixed by #10112, please close as duplicate.

Change History (5)

comment:1 Changed 11 years ago by drkirkby

  • Description modified (diff)

comment:2 Changed 11 years ago by mhansen

See the patch at #10112.

comment:3 Changed 10 years ago by drkirkby

  • Cc fwclarke burcin added
  • Description modified (diff)

Since there appears to be some disagreement about the code changes on #10112, if those can't be resolved soon, I suggest we just change the documentation on this ticket. The 3 changes needed are:

  • The error message "n must be greater than lbound " is incorrect, and should be changed to "n must be at least lbound"
  • The example random_prime(200, lbound=100) is added
  • The example random_prime(200, proof=False, lbound=100) is added.

comment:4 Changed 9 years ago by fwclarke

  • Status changed from new to needs_review

comment:5 Changed 9 years ago by fwclarke

  • Description modified (diff)
  • Status changed from needs_review to positive_review
Note: See TracTickets for help on using tickets.