Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70007

Plotting the integer-and-fraction remainder of a function value modulo 360

Date 2014-04-09 21:32 -0700
From Kim Plofker <kim_plofker@yahoo.com>
Subject Plotting the integer-and-fraction remainder of a function value modulo 360
Newsgroups comp.lang.python
Message-ID <mailman.9111.1397104356.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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, which is defined in terms of the variable t. I just want to plot Longitude modulo 360 for a range of values of t: that is, for every value of t, plot the integer-AND-fraction remainder after dividing Longitude by 360.

But Python (in Sage) apparently won't let me use the int function or the // operator on functions defined in terms of a variable: I get a "cannot evaluate symbolic expression numerically" TypeError. How do I do this? There must be a simple way to tell Python that I want it to compute the value of Longitude for a given value of t and then take the integer-and-fraction remainder from dividing by 360.



Many thanks,
Kim

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Plotting the integer-and-fraction remainder of a function value modulo 360 Kim Plofker <kim_plofker@yahoo.com> - 2014-04-09 21:32 -0700
  Re: Plotting the integer-and-fraction remainder of a function value modulo 360 Steven D'Aprano <steve@pearwood.info> - 2014-04-10 05:01 +0000
    Re: Plotting the integer-and-fraction remainder of a function value modulo 360 Kim Plofker <kim_plofker@yahoo.com> - 2014-04-09 22:12 -0700

csiph-web