sympy_gamma icon indicating copy to clipboard operation
sympy_gamma copied to clipboard

Improper handling of plot for constant function

Open povinsahu1909 opened this issue 5 years ago • 6 comments

In case of plotting constant function instead of producing a horizontal line as output, sympygamma was redirected to error page. And because of this, there was an error when plotting an expression that results in constant term.

IMO, this can be improved by using updated modules from sympy rather than using the currently used modules.

povinsahu1909 avatar Mar 15 '20 07:03 povinsahu1909

This appears to have been fixed with the new upgrade to Python 3?

Mathbone avatar Dec 28 '20 17:12 Mathbone

What would you type into sympy gamma to test this?

oscarbenjamin avatar Dec 28 '20 17:12 oscarbenjamin

plot(y=3)

Seems to be what they were implying, though admittedly my testing was not extremely thorough.

Mathbone avatar Dec 28 '20 20:12 Mathbone

After a little more testing I see what the issue is: The system can't handle things like plot(3) so if the user is entering things that they don't know simplify to a constant (e.g. (plot((2x+3)-2x)), they get an unhelpful error. If they had instead entered plot(y=(2x+3)-2x) they receive the proper plot, but in the long run this seems to put too much syntax burden on the user for a system patterned on the "natural language/Wolfram" model.

Mathbone avatar Dec 28 '20 21:12 Mathbone

I'm new to open source. Does this seem like a good first issue to contribute on?

I poked around in the code and I'm worried I might come up against a foundational issue because it seems like the decision was made to have the system "forget" about the variables in the expression the user originally typed before generating the cards. My first thought to resolve it would have been to check whether the parser had detected variables, and prefer the plot if variables were present.

Mathbone avatar Dec 30 '20 01:12 Mathbone

It could be a good first issue. I don't know the sympy gamma codebase at all and I'm not sure who can advise. Maybe @aktech?

oscarbenjamin avatar Dec 30 '20 12:12 oscarbenjamin