octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51748] [octave-forge] (symbolic) vpa producin


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #51748] [octave-forge] (symbolic) vpa producing strange results
Date: Mon, 14 Aug 2017 19:10:20 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

Follow-up Comment #5, bug #51748 (project octave):

This one is not wrong:

print(N((5**.5)**4, 30))


There python has done a floating point computation which we then ask to
magically convert to 30 digits accuracy. That aint gonna happen: the
computation was already done in lower precision.


The case with the string is less obvious:

print(N('(5^.5)^4', 30))


This depends on exactly what SymPy promises for string input to N.  I'm not
sure what is promised (docs don't say you're supposed to pass strings to N at
all) but what is done currently in practice is pass the input to `sympify`
which will evaluate that expression (that is compute a double precision
floating point).

Interestingly, one can do this:

>>> N(sympify('(5^.5)^4', evaluate=False),
30)
25.0000000000000000000000000000

I'm not sure that would be a good change for SymPy or not: but as Mike as
said, that's a discussion for upstream.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51748>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]