Thank you. That is more or less what I was looking for. However, is there any shorthand way of getting srange to include the final endpoint? While srange(0,1.0,0.1,include_endpoint=True) works, it is somewhat more verbose than I am used to.
On Mar 28, 12:45 pm, David Joyner <[email protected]> wrote: > On Mon, Mar 28, 2011 at 7:28 AM, ObsessiveMathsFreak > > <[email protected]> wrote: > > This is a simple question, but I can't find anything in the > > documentation about it. > > > I would like to declare a simple arithmetic sequence in sage. I use > > this a lot for discrete plots, etc. In octave, syntax such as > > [0:0.1:1] returns the sequence > > > 0.0 0.2 0.4 0.6 0.8 1.0 > > > Is there such a shorthand syntax for these kinds of sequences in sage? > > srange is what you want: > sage: srange(0, 1, 0.2) > [0.000000000000000, 0.200000000000000, 0.400000000000000, > 0.600000000000000, 0.800000000000000] > Type srange? for more details on the syntax. > > > I know about the shorthand [1..10] for integers, but this does not > > seem to work for general arithmetic sequences. The range() function > > also will not work correctly with non integer steps. > > > -- > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group > > athttp://groups.google.com/group/sage-support > > URL:http://www.sagemath.org -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
