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

Add function to return the nth s-gonal number #27986

Closed
sheareralexj mannequin opened this issue Jun 14, 2019 · 38 comments
Closed

Add function to return the nth s-gonal number #27986

sheareralexj mannequin opened this issue Jun 14, 2019 · 38 comments

Comments

@sheareralexj
Copy link
Mannequin

sheareralexj mannequin commented Jun 14, 2019

This ticket adds a function to return elements of the s-gonal sequences. For example, this enables:

sage: tri = [polygonal_number(3, n) for n in [0..9]]
sage: tri
[0, 1, 3, 6, 10, 15, 21, 28, 36, 45]
sage: square = [polygonal_number(4, n) for n in [0..9]]
sage: square
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Component: combinatorics

Author: Alex Shearer

Branch/Commit: e10fd35

Reviewer: Jonathan Kliem

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

@sheareralexj sheareralexj mannequin added this to the sage-8.8 milestone Jun 14, 2019
@sheareralexj

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Jun 14, 2019

comment:2

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

@embray
Copy link
Contributor

embray commented Jun 14, 2019

comment:3

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

@embray embray removed this from the sage-8.8 milestone Jun 14, 2019
@sheareralexj sheareralexj mannequin self-assigned this Jun 18, 2019
@sheareralexj sheareralexj mannequin added this to the sage-8.9 milestone Jun 18, 2019
@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 18, 2019

Author: gh-sheareralexj

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 18, 2019

Changed author from gh-sheareralexj to sheareralexj

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 19, 2019

Branch: u/gh-sheareralexj/27986

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 19, 2019

Changed branch from u/gh-sheareralexj/27986 to u/sheareralexj/27986

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 19, 2019

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 19, 2019

Changed branch from t/27986/add_function_to_return_the_nth_s_gonal_number to none

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 19, 2019

Changed author from sheareralexj to none

@sheareralexj sheareralexj mannequin added p: trivial / 5 and removed p: minor / 4 labels Jun 19, 2019
@sheareralexj sheareralexj mannequin removed their assignment Jun 19, 2019
@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 20, 2019

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 20, 2019

Author: Alex Shearer

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 20, 2019

New commits:

b829a4327986: Added function to return polygonal numbers

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 20, 2019

Commit: b829a43

@sheareralexj sheareralexj mannequin added the s: needs review label Jun 20, 2019
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

c32502827986: Removed restriction on n - can now find polygonal numbers for negative indices

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2019

Changed commit from b829a43 to c325028

@embray
Copy link
Contributor

embray commented Dec 30, 2019

comment:15

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-8.9, sage-9.1 Dec 30, 2019
@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 Apr 14, 2020
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 31, 2020

Changed commit from c325028 to a616782

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 31, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

3ef7663Merge branch 'u/gh-sheareralexj/add_function_to_return_the_nth_s_gonal_number' of git://trac.sagemath.org/sage into test_27986
a61678227986: Updated documentation

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented May 31, 2020

comment:19

Made the changes above and updated the documentation

@kliem
Copy link
Contributor

kliem commented Jun 2, 2020

comment:21

Some more minor things I missed before.

-    - ``s`` -- integer; the size of the polygon. For example, `s = 3`
-      returns a 3-gonal (triangular) number. `s` must be greater than 1.
+    - ``s`` -- integer greater than 1; the number of sides of the polygon
  • The details from the input block about s are probably easier to read for a user on the example block as in:
EXAMPLES:

The triangular numbers::

    sage: [polygonal_number(3, n) for n in range(10)]
    [0, 1, 3, 6, 10, 15, 21, 28, 36, 45]

The square numbers::

    sage: [polygonal_number(4, n) for n in range(10)]
    [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

The pentagonal numbers::

    sage: [polygonal_number(5, n) for n in range(10)]
    [0, 1, 5, 12, 22, 35, 51, 70, 92, 117]

The hexagonal numbers::

    sage: [polygonal_number(6, n) for n in range(10)]
    [0, 1, 6, 15, 28, 45, 66, 91, 120, 153]
  • It would be great if the other examples could be shortly illustrated by half a sentence or so. (Maybe something as The input is converted to an integer).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Changed commit from a616782 to 856d669

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

856d66927986: Updated input block and example documentation

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 2, 2020

comment:23

Thank you Jonathan, I made your suggested edits

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Changed commit from 856d669 to cccb629

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

cccb62927986: updated documentation

@kliem
Copy link
Contributor

kliem commented Jun 3, 2020

comment:25

One last thing I noticed by the the bots:

-    EXAMPLES::
+    EXAMPLES:

    The triangular numbers::

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 3, 2020

Changed commit from cccb629 to 1cbb3ac

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 3, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

1cbb3ac27986: Updated examples block

@sheareralexj
Copy link
Mannequin Author

sheareralexj mannequin commented Jun 3, 2020

comment:27

Fixed

@tscrim
Copy link
Collaborator

tscrim commented Jun 3, 2020

comment:28

One other trivial thing:

     REFERENCES:
 
-        :wikipedia:`Polygonal_number`
+    :wikipedia:`Polygonal_number`

(or possibly with a bullet point - :wikipedia:...).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 4, 2020

Changed commit from 1cbb3ac to e10fd35

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 4, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

e10fd3527986: updated references block

@kliem
Copy link
Contributor

kliem commented Aug 15, 2020

comment:30

Sorry, forgot about this. It has been fine for a while now.

@vbraun
Copy link
Member

vbraun commented Aug 23, 2020

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

5 participants