Skip to content

Conversation

@NadiaYvette
Copy link
Contributor

This adds addition theorems, Pythagorean analogues, and derivatives where absent for cos, sin, cosh, sinh, and sn, cn, and dn in a new file in test/ -- Jacobi.hs derived from Sym.hs (mostly a copy with some new primops and rewrite rules).

@alt-romes
Copy link
Owner

This is great work! Thanks for doing it.
A couple of comments

  • If you could squash the commits it'd be great
  • A few more identities would be amazing, you've already set all the infrastructure inplace, so it seems worth using it a bit further

@NadiaYvette NadiaYvette force-pushed the nadia.chambers/jacobi-elliptic-simplify-01 branch from a26f724 to 611b2ea Compare June 14, 2023 16:17
@alt-romes
Copy link
Owner

Looking good (modulo the squashing, no hurries though). How's the situation?
Let me know if you need any help.

@NadiaYvette NadiaYvette force-pushed the nadia.chambers/jacobi-elliptic-simplify-01 branch from 9caffb1 to aaaa5af Compare June 15, 2023 04:06
@NadiaYvette
Copy link
Contributor Author

@alt-romes The squash will definitely be done, and maybe I should do one even before passing the tests. There's just a little trouble at the moment getting things to pass the tests. Achieving sum-of-products while collecting powers of variables in monomials is taking some thought to figure out how to deal with by using a cost function.

@alt-romes
Copy link
Owner

I see, that doesn't sound easy indeed!
OK, good luck, ping me when you're ready, or stuck 😄

@NadiaYvette
Copy link
Contributor Author

I see, that doesn't sound easy indeed! OK, good luck, ping me when you're ready, or stuck smile

@alt-romes It's probably safe to say that I'm a little stuck. The good news is that the rules seem to be involved enough to get testcases to spin for something like 45s.

@alt-romes
Copy link
Owner

Great @NadiaYvette! That's good for benchmarking and optimizing the library further.

I would argue that getting a cost function to arrive at a SOP simplification is not all that too important, not for the testsuite at least (it would be different if this were a symbolic maths library -- i'd like to do that some time in the image of Metatheory.jl, but in a separate project).

Is your problem only that the simplification doesn't end up exactly as the one you wrote for the test?

If so, I suggest you look at whatever it actually does rewrite the expressions too, and manually see if they are equivalent to the ones you were expecting, and if they were in fact simplified. If all is good, just write the thing it produces as the expected output -- even if that isn't exactly what you'd expect from a computer algebra system.

NadiaYvette and others added 10 commits July 13, 2025 12:53
Various of these fail in a way, though they may be faults in the
cost functions rather than the rewrite rules per se.
It's now a type synonym, so the decl is no longer valid.
Guiding sum-of-products simplification via cost functions with access
only to outermost constructors is difficult. The effects are limited.
Also have the special value sinh(0)=0 and restore underscored
helper function's name for use in the identities.
@alt-romes alt-romes force-pushed the nadia.chambers/jacobi-elliptic-simplify-01 branch from 6ae764c to e6630fa Compare July 13, 2025 14:07
@alt-romes
Copy link
Owner

I've rebased your PR and fixed the build and a TODO @NadiaYvette.
I looked into the second test taking a long time but it never terminates for me. The test seemingly runs forever.
I profiled it but the issue seems to be caused by some exponential rule application.
To debug I guess one would try to see which rules are firing throughout eq-sat. Unfortunately I'm not too familiar with the Jacobi domain here, so it's hard for me to debug.

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

Successfully merging this pull request may close these issues.

2 participants