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


Groups > comp.lang.python > #106178

Re: sympy

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: sympy
Date Thu, 31 Mar 2016 19:51:55 +0200
Organization None
Lines 30
Message-ID <mailman.275.1459446733.28225.python-list@python.org> (permalink)
References <733f5f0d-9b4e-4023-897b-e1f2730c39cb@googlegroups.com> <56fbcd01$0$1599$c3e8da3$5496439d@news.astraweb.com> <99b7cf43-50ff-4de7-8de0-e324658682bf@googlegroups.com> <56fbf7e7$0$1591$c3e8da3$5496439d@news.astraweb.com> <244e1277-e105-4419-a449-7f2012c6d78e@googlegroups.com> <ndjdpv$bkd$1@ger.gmane.org> <CAPTjJmpVEKLtq8QX25VNpoWDqptY4Hyqr5pRYq6ZQWXN1SGUtA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de XWX7fIWk3LIzTKpJjXHugwQtmTs9KyQyIRdIra5/en/Q==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; '2016': 0.16; 'evaluated.': 0.16; 'evaluations': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'trap': 0.16; 'value:': 0.16; 'wrote:': 0.16; 'fix': 0.21; 'not,': 0.22; 'am,': 0.23; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'fri,': 0.27; 'accidentally': 0.29; 'fast.': 0.29; 'invoke': 0.29; 'guess': 0.31; 'probably': 0.31; 'another': 0.32; 'maybe': 0.33; 'skip:- 10': 0.34; 'robert': 0.35; 'star': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'wanted': 0.37; 'difference': 0.38; 'skip:- 20': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; '10000': 0.66; '>>>>>': 0.66; 'carefully': 0.72; 'increase': 0.73; 'otten': 0.84; 'maybe,': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd85c1.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:106178

Show key headers only | View raw


Chris Angelico wrote:

> On Fri, Apr 1, 2016 at 1:55 AM, Peter Otten <__peter__@web.de> wrote:
>> Hm, the two functions fmsympy() and fm() do not return the same value:
>>
>> $ python -i sympy_diff.py
>> 10000  evaluations with sympy   : dt1 = 0.7178411483764648
>> 10000  evaluations without sympy: dt2 = 0.10177111625671387
>>>>> fm(42)
>> cos(42)
>>>>> fmsympy(42)
>> -0.399985314988351
>>
> 
> Maybe not, but that's simply because one of them is completely
> evaluated. The cosine of 42 radians is indeed -0.4ish.
> 
>>>> math.cos(42)
> -0.39998531498835127

My guess was that the OP fell into the trap that he himself carefully set up 
with the star import, and accidentally used sympy.cos() where he wanted to 
invoke math.cos().

The fix would actually increase the speed difference -- but first make it 
right, then, maybe, fast.

Adding another storey to the tower of guesses, Robert Kern has probably 
already provided the answer ;)

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


Thread

sympy Poul Riis <priisdk@gmail.com> - 2016-03-30 04:17 -0700
  Re: sympy Ben Finney <ben+python@benfinney.id.au> - 2016-03-30 22:29 +1100
  Re: sympy Ned Batchelder <ned@nedbatchelder.com> - 2016-03-30 04:39 -0700
  Re: sympy Steven D'Aprano <steve@pearwood.info> - 2016-03-30 23:56 +1100
    Re: sympy Poul Riis <priisdk@gmail.com> - 2016-03-30 08:23 -0700
      Re: sympy Robert Kern <robert.kern@gmail.com> - 2016-03-30 16:29 +0100
      Re: sympy Steven D'Aprano <steve@pearwood.info> - 2016-03-31 02:59 +1100
        Re: sympy Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-31 17:49 +1300
          Re: sympy Poul Riis <priisdk@gmail.com> - 2016-03-30 23:51 -0700
        Re: sympy Poul Riis <priisdk@gmail.com> - 2016-03-31 03:57 -0700
          Re: sympy Peter Otten <__peter__@web.de> - 2016-03-31 16:55 +0200
          Re: sympy Chris Angelico <rosuav@gmail.com> - 2016-04-01 04:05 +1100
          Re: sympy Peter Otten <__peter__@web.de> - 2016-03-31 19:51 +0200
          Re: sympy Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-03-31 19:59 +0100
  Re: sympy Poul Riis <priisdk@gmail.com> - 2016-03-31 14:33 -0700
    Re: sympy Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-03-31 23:26 +0100

csiph-web