Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Multiple \\int, \\sum, or \\prod statements #13

Open
ledjohnny opened this issue Apr 25, 2016 · 1 comment
Open

Multiple \\int, \\sum, or \\prod statements #13

ledjohnny opened this issue Apr 25, 2016 · 1 comment

Comments

@ledjohnny
Copy link

It seems that adding multiple expressions for \\int,\\sum, or \\prod together will cause an error to occur. For instance:
process_sympy("\\int_{-3}^{4} \\frac{1}{x}dx+\\int_{1.5}^{2} \\ln(x)dx")
Throws:

UnboundLocalError: local variable 'int_var' referenced before assignment

In PS.g4, I found a way to allow summing multiple integrals.
Change:
| FUNC_INT
(subexpr supexpr | supexpr subexpr)?
(additive? DIFFERENTIAL | frac | additive)

To:
| FUNC_INT
(subexpr supexpr | supexpr subexpr)?
(additive? DIFFERENTIAL)

Unfortunately, this doesn't allow differentials to be in fractional form. For example: \\int_{3}^{5} dx/x

Thanks for your time,
John

@augustt198
Copy link
Owner

Yeah parsing those is a real pain. The problem is that people expect something like
\int a + b dx to be handled by the parser, when really \int (a + x) dx would be the correct notation (and would be very easy to parse).

This forces us to capture multiple terms inside the integral, which can lead to the next integral being captured as well.

I think it's likely that to handle this the parse tree will have to be modified after antlr is finished.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants