sympy / sympy_gamma

A SymPy version of WolframAlpha.
https://sympygamma.com
Other
674 stars 112 forks source link

Integral steps error - AttributeError: 'tuple' object has no attribute '_asdict' #27

Open MarsEdge opened 10 years ago

MarsEdge commented 10 years ago

link: http://www.sympygamma.com/input/?i=%284x%2B2%29%2F%283x-4%29

simply click on the "See Steps" button in the "Antiderivative forms" box

I came across this by accident when testing the integral step-by-step feature. Derivative works fine though.

There was an error in Gamma. For reference the last five traceback entries are: Traceback (most recent call last): 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/views.py", line 278, in eval_card 
    result = g.eval_card(card_name, expression, variable, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/logic.py", line 322, in eval_card 
    result = card.eval(evaluator, components, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/resultsets.py", line 97, in eval 
    return self.card_info['eval_method'](evaluator, components, parameters) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/resultsets.py", line 643, in eval_intsteps 
    return intsteps.print_html_steps(integrand, components['variable']) 
File "/base/data/home/apps/s~sympy-gamma-hrd/19.372006176671940865/app/logic/intsteps.py", line 341, in print_html_steps 
    a = HTMLPrinter(rule) 
AttributeError: 'tuple' object has no attribute '_asdict' 
lidavidm commented 10 years ago

It also seems to give the wrong answer for the integral.

asmeurer commented 10 years ago

I don't think the answer is wrong. integrate gives 4*x/3 + 22*log(9*x - 12)/9 and manualintegrate gives 4*x/3 + 22*log(12*x - 16)/9, but these are both fine, because the only difference is a factor of 4/3 in the log, which can be pulled out as a constant additive factor. In other words, the two answers differ by a constant, which is fine

In [23]: print(simplify(integrate((4*x+2)/(3*x-4)) - integrate((4*x+2)/(3*x-4), manual=True)))
-44*log(2)/9 + 22*log(3)/9