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

feat: Add derivatives, incl. high-order and mixed partial #3701

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Leedehai
Copy link

@Leedehai Leedehai commented Sep 1, 2022

Support ordinary derivatives \odv and partial derivatives \pdv.

It supports high-order mixed partial derivatives. The syntax emulates popular $\LaTeX$ packages that provide this sought-after feature.

  • Demo. More in test screenshots.
  • 'yarn start' URL that produced the demo.
  • Sensible fallbacks; if users mistyped their expressions they wouldn't be confused by blankness on the screen.
  • Produced screenshots for tests.
  • Added to the docs.
  • Already signed CLA.

@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #3701 (7a3aee7) into main (176552a) will increase coverage by 0.00%.
The diff coverage is 93.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3701   +/-   ##
=======================================
  Coverage   92.97%   92.98%           
=======================================
  Files          91       92    +1     
  Lines        6765     6825   +60     
  Branches     1571     1590   +19     
=======================================
+ Hits         6290     6346   +56     
- Misses        437      441    +4     
  Partials       38       38           
Impacted Files Coverage Δ
src/functions/utils/assembleDerivative.js 93.22% <93.22%> (ø)
src/functions/genfrac.js 94.29% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef49e2b...7a3aee7. Read the comment docs.

@Leedehai
Copy link
Author

Leedehai commented Sep 3, 2022

I noticed issue #3038 (citing #3184) mentioned maintainer @edemaine recommends using the macro system to implement derivatives instead of the genfrac function.

Therefore, I (author of this PR) re-implemented the feature with a new PR #3703 🙂.

@ronkok
Copy link
Collaborator

ronkok commented Sep 8, 2022

@Leedehai Thank you for the pull request. I have some questions.

  1. MathJax has a physics extension that implements part of the LaTeX physics package. In the MathJax extension, some of the functions have behavior that does not quite match the LaTeX function. It appears that the MathJax behavior is simplified so that it can be expressed in MathJax macros. I'm guessing that you avoided using a macro for this PR because the current KaTeX macro language cannot fully express the functionality of the LaTeX commands. Is my assumption correct?

  2. PR feat: add basic \odv and \pdv #3273 also takes a macro approach. Is this PR closer to LaTeX behavior than PR feat: add basic \odv and \pdv #3273?

  3. If PR feat(macro): add basic conditional support #3385 was approved and merged, could you then use macros to fully implement \odv and \pdv?

@Leedehai
Copy link
Author

Leedehai commented Sep 9, 2022

Hi @ronkok thanks for your response! To answer your questions:

  1. KaTeX's macro system is powerful enough to implement derivative macros. Please see my PR feat: Add derivatives, incl. high-order and mixed partial, using macros #3703 as mentioned in the comment above. It has the same feature as the current PR.
  2. This PR and PR 3703 covers more ground than PR 3273 you mentioned, as my PRs support high-order & mixed-order derivatives. Please refer to the screenshots in either the current PR 3701 or my PR 3703 (both PRs of mine have the same feature and you may merge either one).
  3. Not necessary to wait for that PR; as mentioned, the existing macro system is able enough.

Thanks!

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.

None yet

2 participants