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

StackOverflowError occurs when computing Simplify(Sin(Pi*Cosh(45522*Csc(17/36*Pi)))) #930

Open
tranleduy2000 opened this issue Mar 10, 2024 · 2 comments
Assignees
Labels

Comments

@tranleduy2000
Copy link
Sponsor Collaborator

There is the input

Simplify(Sin(Pi*Cosh(45522*Csc(17/36*Pi))))
image
java.lang.StackOverflowError
	at org.matheclipse.core.expression.F.ast(F.java:8625)
	at org.matheclipse.core.expression.F.PlusAlloc(F.java:14349)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:284)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
	at org.matheclipse.core.reflection.system.TrigExpand$TrigExpandFunction.expandCoshPlus(TrigExpand.java:292)
@axkr
Copy link
Owner

axkr commented Mar 10, 2024

Best solution would be to transform these recursions in TrigExpand into an iterative loop.

"Work around" can be to set: Config.MAX_AST_SIZE = 20000 to avoid to big expressions.

@axkr axkr self-assigned this Mar 10, 2024
@axkr axkr added the bug label Mar 10, 2024
@axkr
Copy link
Owner

axkr commented Mar 10, 2024

TODO replace other recursive versions in TrigExpand#expandPlus() with iterative versions

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

No branches or pull requests

2 participants