Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ok.': 0.04; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:log': 0.09; 'examples': 0.11; 'argument': 0.15; '(lambda': 0.16; 'bieber': 0.16; 'declaimed': 0.16; 'defer': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'installed,': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'subject:function': 0.16; 'symbolic': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; '>>>': 0.18; 'trying': 0.21; 'url:home': 0.21; 'maybe': 0.21; "doesn't": 0.22; 'itself,': 0.23; 'aug': 0.24; 'function': 0.27; 'skip:[ 10': 0.27; 'raise': 0.28; 'lee': 0.28; 'expressions': 0.29; 'example': 0.30; 'sun,': 0.30; 'typeerror:': 0.30; 'list': 0.32; 'there': 0.33; 'to:addr :python-list': 0.33; '???': 0.34; 'header:X-Complaints-To:1': 0.35; 'subject:How': 0.35; 'charset:us-ascii': 0.36; 'but': 0.37; 'subject:can': 0.38; 'received:org': 0.38; 'subject:: ': 0.39; 'ok,': 0.39; 'header:Mime-Version:1': 0.39; 'define': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'show': 0.67; 'subject:like': 0.67; 'online': 0.71; 'dennis': 0.77; 'below:': 0.80; 'exp,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: How can I solve a equation like solve a function containint expressions like sqrt(log(x) - 1) = 2 and exp((log(x) - 1.5)**2 - 3) = 5 Date: Sat, 27 Aug 2011 13:53:20 -0700 Organization: > Bestiaria Support Staff < References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: user-11fb6hj.dsl.mindspring.com X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314478507 news.xs4all.nl 2402 [2001:888:2000:d::a6]:51817 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12300 On Sun, 28 Aug 2011 03:24:33 +0800, Xiong Deng declaimed the following in gmane.comp.python.general: > >>>solve(x * ((1.0 / sqrt(2 * pi) * x * sigma) * exp(-0.5 * (log(x) - mu)**2 > / sigma**2)) + 0.5 * erfc((mu - log(x)) / (sigma * sqrt(2))) - 1, x) > > raise TypeError("cannot create mpf from " + repr(x)) > TypeError: cannot create mpf from x > > But sqrt, log, exp, itself is OK, as shown as below: > > >>> solve((1.0 / sqrt(2 * pi) * x * sigma) - 1, x) > [0.626657068657750] > > SO, How can I solve an equation containint expressions like sqrt(log(x) - > 1)=0 or exp((log(x) - mu)**2 - 3) = 0??? If there are any other methods > without Sympy, it is still OK. > Trying a WAG... Perhaps you need to defer execution of said functions within the equation... Maybe with lambda? (lambda x=x: log(x))(x) ??? I don't have sympy installed, and the online example of .solve() doesn't show any examples with nested functions (that is, where 'x' is an argument to a function that is itself an argument to a function in the equation). Or perhaps you need to define log() as a symbolic function itself, and include it in the list of variables? -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/