On 4/10/2014 1:03 AM, Kim Plofker wrote:
Thanks, the % operator is indeed what I want, but I want to use it with
a function expression rather than with numbers alone. And that seems to
create a type error.
Here's an example of what goes wrong:
t = var('t')
L(t) = t*725.5%360.0
This produces t
Kim Plofker writes:
> This produces the following error message:
Thank you for providing an actual code example (though not one I can
run, since it isn't a complete Python program).
Particularly, thank you for providing the *actual* error output; this
makes it much clearer what is happening.
I
eed a
Sage-specific problem rather than something I could work around in Python?
Many thanks again for any help.
Kim
From: Ben Finney
To: python-list@python.org
Sent: Thursday, April 10, 2014 12:54 AM
Subject: Re: Plotting the integer-and-fraction remainder of a f
st@python.org
Sent: Thursday, April 10, 2014 1:01 AM
Subject: Re: Plotting the integer-and-fraction remainder of a function value
modulo 360
On Wed, 09 Apr 2014 21:32:27 -0700, Kim Plofker wrote:
> How can I get Python to represent a value of a function in degrees,
> i.e., with values b
On Wed, 09 Apr 2014 21:32:27 -0700, Kim Plofker wrote:
> How can I get Python to represent a value of a function in degrees,
> i.e., with values between 0 and 360, by taking the (non-integer)
> function expression mod 360?
>
> That is, I have a function with non-integer values, called Longitude,
Kim Plofker writes:
> How can I get Python to represent a value of a function in degrees,
> i.e., with values between 0 and 360, by taking the (non-integer)
> function expression mod 360?
In Python, you simply use the modulo (‘%’) operator::
>>> 45.0 % 360
45.0
>>> 700.0 % 360
3