Forums before death by AOL, social media and spammers... "We can't have nice things"
|    sci.math.symbolic    |    Symbolic algebra discussion    |    10,432 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,318 of 10,432    |
|    Nasser M. Abbasi to oldk1331@gmail.com    |
|    Re: The leaner and meaner Rubi 4.11 now     |
|    29 Mar 17 04:22:20    |
   
   From: nma@12000.org   
      
   On 3/29/2017 3:32 AM, oldk1331@gmail.com wrote:   
   >   
   >> But there were many many changes needed. Not only that, I just found that   
   >> sympy changes all exact numbers to floating point. For example:   
   >>   
   >>> python   
   >>>>> from sympy import *   
   >>>>> x=symbols('x')   
   >>>>> integrate(1/4/sin(1/3*x),x)   
   >>   
   >> 0.375*log(cos(0.333333333333333*x) - 1) - 0.375*log(cos(0.333   
   33333333333*x) + 1)   
   >>   
   >> The above is #4 in Timofeev. Notice how the output is all   
   >> decimal. It turns out, one has to tell sympy not to do this   
   >> by changing the input to   
   >>   
   >>>>> integrate(S('1/4')/sin(S('1/3')*x),x)   
   >>   
   >> 3*log(cos(x/3) - 1)/8 - 3*log(cos(x/3) + 1)/8   
   >>   
   >> So, unless there is a way to tell sympy not to change exact   
   >> numbers to floating point number, I would have to do change   
   >> each number n in the test file to become S('n')? 63,000   
   >> integrals? Not practical.   
   >>   
   >> Will try to ask if there is an option to sympy, so that it   
   >> will do this automatically. This is very strange for a computer   
   >> algebra system to do this.   
   >   
   > From 'isympy -h':   
   >   
   > -i, --int-to-Integer (requires at least IPython 0.11)   
   >   
   > Automatically wrap int literals with Integer. This makes it so that   
   > things like 1/2 will come out as Rational(1, 2), rather than 0.5. This   
   > works by preprocessing the source and wrapping all int literals with   
   > Integer. Note that this will not change the behavior of int literals   
   > assigned to variables, and it also won't change the behavior of functions   
   > that return int literals.   
   >   
   > Also:   
   >   
   > -a, --auto-symbols (requires at least IPython 0.11)   
   >   
   > Automatically create missing symbols. Normally, typing a name of a   
   > Symbol that has not been instantiated first would raise NameError,   
   > but with this option enabled, any undefined name will be   
   > automatically created as a Symbol.   
   >   
      
   Thanks. I am not able to find how to run the Python script I have   
   from isympy and still keep the integers not converted. It works   
   OK, if I type the integrate command from inside isympy. one by one.   
      
   But once I invoke the script which runs the all the integrals,   
   it goes back to floating point. i.e. I do this   
      
   isympy --int-to-Integer timofeev.py   
      
   Where timofeev.py is the python script which reads all the tests   
   and run them one by one and writes the result to result file,   
   then I see floating points in the output.   
      
   but if I do   
      
   isympy --int-to-Integer   
   [1] #and now type the integrate command here   
      
   then yes, it works, no floating point on the terminal now.   
      
   It seems this is meant only for interactive work? What   
   if one wants to run script, with many commands in it but still   
   take advantage of --int-to-Integer?   
      
   I will look more into this and see if I find a way. I know   
   very little about python world. So far, I find it very confusing :)   
      
   --Nasser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca