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,991 of 10,432    |
|    Nasser M. Abbasi to All    |
|    interesting behavior of sympy integrate    |
|    22 Dec 19 14:07:22    |
      From: nma@12000.org              I finished porting Albert Rich grading function from Maple to Python.              Tested it on random integrals, and it gives same grade as Maple for       same input in Python. Now running it on the whole test suite to       verify more the grades.              I found something strange doing this with sympy. (I've seen       this before I think).              Here is an example (sympy 1.5)              (base) >python       from sympy import *       from sympy.abc import z,x       integrand=1/(cos(z)+sin(z)+sqrt(2))       integrate(integrand,z)                     -8764825322083891395107744408255764367335970881679568886584767372       06166480148877802131608460208841059870201798/(-105800800822030308       195426917760537664540035358159831204871954190267657005107678279521       4631108949695080001219479*tan(z/2) + 7481246371622488258548281990       09082431883576062841145246524390135639826645575610848140217669527       057804968160189*sqrt(2)*tan(z/2) - 309883371058054256099440978596       29421351677751875716680219515176703674340550117194707441343942263       7275033059290*sqrt(2) + 43824126610419456975538722041278821836679       8544083978444329238368603083240074438901065804230104420529935100899) +       61976674211610851219888195719258842703355503751433360439030353407       3486811002343894148826878845274550066118580*sqrt(2)/(-10580080082       20303081954269177605376645400353581598312048719541902676570051076       782795214631108949695080001219479*tan(z/2) + 7481246371622488258       48281990090824318835760628411452465243901356       39826645575610848140217669527057804968160189*sqrt(2)*tan(z/2) -        098833710580542560994409785962942135167775187571668021951517670       36743405501171947074413439422637275033059290*sqrt(2) + 438241266       0419456975538722041278821836679854408397844432923836860       3083240074438901065804230104420529935100899)                     But if the integrand is simplified first, then              simplify(integrand)        sqrt(2)/(2*(sin(z + pi/4) + 1))                     integrate(simplify(integrand),z)               -sqrt(2)/(tan(z/2 + pi/8) + 1)              Much better and shorter result, which will get better grade.              Since the build program does not add "simplify" to each integrand,       such strange result will happen with sympy on a number of tests.              I could add an automatic "simplify" for sympy to simplify the integrand       before calling integrate in order to work around this issue.              Should I do this (i.e. add explicit simplify for sympy?) or leave it       as is now? Since all other CAS system do not have this issue.              --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