Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!eweka.nl!lightspeed.eweka.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'modulo': 0.09; 'operand': 0.09; 'similar,': 0.09; 'types:': 0.09; '--------': 0.10; 'python': 0.11; 'posted': 0.15; 'compute': 0.16; 'different,': 0.16; 'expressions,': 0.16; 'i.e.,': 0.16; 'itself,': 0.16; 'operator.': 0.16; 'received:66.196': 0.16; 'remainder': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'typeerror:': 0.16; 'using,': 0.16; 'thursday,': 0.16; 'language': 0.16; 'fix': 0.17; 'thanks,': 0.17; 'wrote:': 0.18; 'library': 0.18; 'variable': 0.18; 'wed,': 0.18; "skip:' 30": 0.19; 'example': 0.22; 'import': 0.22; '(in': 0.22; 'to:name :python-list@python.org': 0.22; 'this?': 0.23; 'error': 0.23; 'library,': 0.24; 'looks': 0.24; 'sort': 0.25; "i've": 0.25; '>': 0.26; 'least': 0.26; 'defined': 0.27; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'function': 0.29; "doesn't": 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; '"",': 0.31; '-0700,': 0.31; 'apparently': 0.31; "d'aprano": 0.31; 'kim': 0.31; 'mod': 0.31; 'produces': 0.31; "skip:' 40": 0.31; 'steven': 0.31; 'symbolic': 0.31; 'file': 0.32; 'probably': 0.32; 'thanks!': 0.32; 'url:python': 0.33; '(most': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'could': 0.34; 'problem': 0.35; 'received:66': 0.35; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'url:org': 0.36; 'error.': 0.37; 'email addr:python.org': 0.37; 'represent': 0.38; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'skip:- 10': 0.38; 'recent': 0.39; 'skip:_ 30': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'expression': 0.60; 'is.': 0.60; 'received:bf1.yahoo.com': 0.60; 'received:mail.bf1.yahoo.com': 0.60; 'tell': 0.60; 'full': 0.61; 'range': 0.61; 'simple': 0.61; "you're": 0.61; 'show': 0.63; 're:': 0.63; 'different': 0.65; 'taking': 0.65; 'email name:python-list': 0.65; 'between': 0.67; 'header:Reply-To:1': 0.67; 'experts.': 0.68; 'received:98.139.212': 0.68; 'evaluate': 0.72; 'received:bullet.mail.bf1.yahoo.com': 0.74; '360': 0.84; 'degrees,': 0.84; 'longitude': 0.84; 'type(s)': 0.84; 'better!': 0.91 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 572171.58488.bm@omp1009.mail.bf1.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1397106764; bh=kcmyLPstuXF1UVB7s5s/bjsElE3TEm4qEF/7Mbn26ps=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=U/eF2p0l52GKwkABh5UhKFecEuBlhynnLhBoDEPYnorjyE5TMTApcXRngOWbiZERaZWraugc8BMGiZtwyeNM/tmtnD47YRvLK1WJAw/OlY+jTSctlUhsxcqap6ppYHinE9krF+1npBIawUhGOHXiEJOyckpQqQJbF29IyksI3ek= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=CLr+Vm7Xy5FtXGPM79Q34DLDtRZqMpZ1tpBguIBerDQPhHoNs/t5MHovJQe00m3iXD3p1+5MJ4dKxi4dOsHpVmMqXrt7T5FAHu3lfgwqmOG8UmO8UbxV/m22ZqVjl2ePun/ssMj2JKNDMCELcbGz9muvM9jscnlGMIM0AOJ9hbY=; X-YMail-OSG: gD6_UrIVM1k_ZMehilHGFr0g5OVF0n9tvgdAD6hWfgD3Tud uN7azK1UXLVDwyIHFMsS6W0ZNUV6Z4aUzO1MWNewKO2O00jfcF_vu.sIdKv4 0jFi0lF084x4MsCIAt3pUPLXModSABEAVAQtIzYQ0jEzPDCoSmZfrUyrdWrj KzSgE9cwiyn0MlZFQWRE9lol9VlMTE3kz09NtIG3yAXrbsWTg_6HVdwDs0W2 .zialw5vTKIkSmymhLVCYcf7C3bp6m8ptmjP3_7KTUuIlbswmsuVSPbp17TS wLW1iyJYDIAeHcYz.KLuujWFhqcrrMggUqAmOjupURjDOJhGYHTe6tDx1HAP ynOLVyu0Dd9LoqBrv8uanpC_MxtbVl2yxgyQWMHJ8agDvHdyeBzl1Zy.4YIH VtLze_I2bfWQmEN3eIsgxNpy6OOUhCPZ9YXIVPq.vn7iiuK1tON48xG2rcj1 mKo6CF5X8OgDKLzEaERFlCaX.0LRKVIXMJ_w.ycZoFzMSERrYRsR2xI.MK4J FXTJq.vWBkM1jeJv0maixQTR7yP6BWfScciGRwyKZAlT9RitIW35M92w- X-Rocket-MIMEInfo: 002.001, VGhhbmtzISDCoEFzIEkgcmVjZW50bHkgcG9zdGVkIGluIGEgZm9sbG93dXAgbWVzc2FnZSwKCi0tLS0tLS0tCkhlcmUncyBhbiBleGFtcGxlIG9mIHdoYXQgZ29lcyB3cm9uZzoKCnQgPSB2YXIoJ3QnKQoKTCh0KSA9IHQqNzI1LjUlMzYwLjAKCgpUaGlzIHByb2R1Y2VzIHRoZSBmb2xsb3dpbmcgZXJyb3IgbWVzc2FnZToKCi4uLgpUeXBlRXJyb3I6IHVuc3VwcG9ydGVkIG9wZXJhbmQgdHlwZShzKSBmb3IgJToKJ3NhZ2Uuc3ltYm9saWMuZXhwcmVzc2lvbi5FeHByZXNzaW9uJyBhbmQKJ3NhZ2Uuc3ltYm9saWMBMAEBAQE- X-Mailer: YahooMailWebService/0.8.182.648 References: <534625b5$0$11109$c3e8da3@news.astraweb.com> Date: Wed, 9 Apr 2014 22:12:44 -0700 (PDT) From: Kim Plofker Subject: Re: Plotting the integer-and-fraction remainder of a function value modulo 360 To: Steven D'Aprano , "python-list@python.org" In-Reply-To: <534625b5$0$11109$c3e8da3@news.astraweb.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1679980782-407868024-1397106764=:87133" X-Mailman-Approved-At: Thu, 10 Apr 2014 08:47:40 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Kim Plofker List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 121 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397112461 news.xs4all.nl 2975 [2001:888:2000:d::a6]:35601 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 961477212 X-Received-Bytes: 15235 Xref: csiph.com comp.lang.python:70017 --1679980782-407868024-1397106764=:87133 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks! =A0As I recently posted in a followup message,=0A=0A--------=0AHere= 's an example of what goes wrong:=0A=0At =3D var('t')=0A=0AL(t) =3D t*725.5= %360.0=0A=0A=0AThis produces the following error message:=0A=0A...=0ATypeEr= ror: unsupported operand type(s) for %:=0A'sage.symbolic.expression.Express= ion' and=0A'sage.symbolic.expression.Expression'=0A--------=0A=0A=0ASo it l= ooks like I've got a Sage-specific problem. =A0I still don't know how to fi= x it, but at least I understand the problem better! =A0=0A=0AMany thanks,= =0AKim=0A=0A________________________________=0A From: Steven D'Aprano =0ATo: python-list@python.org =0ASent: Thursday, April 10, = 2014 1:01 AM=0ASubject: Re: Plotting the integer-and-fraction remainder of = a function value modulo 360=0A =0A=0AOn Wed, 09 Apr 2014 21:32:27 -0700, Ki= m Plofker wrote:=0A=0A> How can I get Python to represent a value of a func= tion in degrees,=0A> i.e., with values between 0 and 360, by taking the (no= n-integer)=0A> function expression mod 360?=0A> =0A> That is, I have a func= tion with non-integer values, called Longitude,=0A> which is defined in ter= ms of the variable t. I just want to plot=0A> Longitude modulo 360 for a ra= nge of values of t: that is, for every=0A> value of t, plot the integer-AND= -fraction remainder after dividing=0A> Longitude by 360.=0A> =0A> But Pytho= n (in Sage) apparently won't let me use the int function or the=0A> // oper= ator on functions defined in terms of a variable: I get a "cannot=0A> evalu= ate symbolic expression numerically" TypeError. =0A=0AThat's an issue with = Sage itself, probably sympy. Python the language =0Adoesn't natively unders= tand symbolic expressions, that's added by sympy, =0Aso you may need to ask= some sympy experts.=0A=0AIt may help if you show the actual code you are u= sing, and the full =0Atraceback generated by the error. When I try somethin= g similar, I get a =0Adifferent error message:=0A=0Apy> from sympy.abc impo= rt x=0Apy> (x + 1) % 60=0ATraceback (most recent call last):=0A=A0 File "", line 1, in =0ATypeError: unsupported operand type(s) for %:= 'Add' and 'int'=0A=0A=0Awhich could mean I'm doing something different, or= just a difference in =0Aversion numbers.=0A=0A=0A> How do I do this?=0A> T= here must be a simple way to tell Python that I want it to compute the=0A> = value of Longitude for a given value of t and then take the=0A> integer-and= -fraction remainder from dividing by 360.=0A=0AThat's simple with numeric t= ypes: use the divmod function or % operator. =0ABut you're using some sort = of symbolic library, so we need to know what =0Athe library is.=0A=0A=0A-- = =0ASteven=0A-- =0Ahttps://mail.python.org/mailman/listinfo/python-list --1679980782-407868024-1397106764=:87133 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks!  As I recently posted in a followup m= essage,
-------= -
Here's an= example of what goes wrong:

t =3D var('t')
L(t) =3D t*725.5%360.0

This produces the following error message:

...=0ATypeError: unsupported operand type(s) for %:=
=0A'sage.symbolic.expression.Expression' and=0A'sage.symbolic.expression.Ex=
pression'
--------

So it looks like I've got a Sage-specific problem.=  I still don't know how to fix it, but at least I understand the prob= lem better!  

=
Many thanks,
K= im

From: Steven D'Aprano <steve@pearwood.info>
To: python-list@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 v= alue of a function in degrees,
> i.e., with values between 0 and 360, by takin= g the (non-integer)
> function expression mod 360?
>
> T= hat 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 l= et me use the int function or the
> // operator on functions defined = in terms of a variable: I get a "cannot
> evaluate symbolic expressio= n numerically" TypeError.

That's an issue with Sage itself, probabl= y sympy. Python the language
doesn't natively understand symbolic expre= ssions, that's added by sympy,
so you may need to ask some sympy expert= s.

It may help if you show the actual code you are using, and the full
traceback generated by the error. When I try something simila= r, I get a
different error message:

py> from sympy.abc import= x
py> (x + 1) % 60
Traceback (most recent call last):
  F= ile "<stdin>", line 1, in <module>
TypeError: unsupported op= erand type(s) for %: 'Add' and 'int'


which could mean I'm doing = something different, or just a difference in
version numbers.

> 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.

That's simple with numeric types: use the divmod function o= r % operator.
But you're using some sort of symbolic library, so we nee= d to know what
the library is.


--
Steven
--
https://mail.python.org/mailman/listinfo/python-list=


--1679980782-407868024-1397106764=:87133--