Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imaginary Support / Equation Simplification #106

Open
NumberC opened this issue Apr 5, 2020 · 4 comments
Open

Imaginary Support / Equation Simplification #106

NumberC opened this issue Apr 5, 2020 · 4 comments

Comments

@NumberC
Copy link

NumberC commented Apr 5, 2020

Hello! Can exp4j work with imaginary numbers or simplifying equations with variables in anyway? If not, would it be theasible to add it as a feature? Thank you!

@shuvamc019
Copy link
Contributor

This question is a little vague, could you elaborate a little bit on what you mean by this?

If you mean plugging in complex values for variables or evaluating expressions with complex coefficients, this likely would not work under the current model of exp4j since evaluated expressions always return a double. There would be no guarantee that the evaluated expression would only have a real part, and unfortunately, it may not be able to be expressed as a double.

If you have ideas on how to handle this, I would be open to hearing about them.

@aleppard
Copy link

I'm looking at integrating an expression parser into my project but I'd like to do calculations with higher precision e.g. 2^64-1 which can't be precisely calculated using a double (or even a long!).

I think the solution to support that and complex numbers is to move away from passing around doubles and working on them directly, but instead pass around a generic Number type which has different implementations, e.g. DoubleNumber, ComplexNumber, QuadNumber, etc. This would be further extendable to support fractions, and more esoteric math such as quarternions, octonions and other fields etc.

@RobertZenz
Copy link

I'm looking at integrating an expression parser into my project but I'd like to do calculations with higher precision e.g. 2^64-1 which can't be precisely calculated using a double (or even a long!).

That would be EvalEx then, which uses BigDecimal.

@aleppard
Copy link

Thanks I didn't know about that project.

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

No branches or pull requests

4 participants