Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
Leedehai wants to merge 2 commits intoKaTeX:mainfrom
Leedehai:derivatives
Open

feat: Add derivatives, incl. high-order and mixed partial#3701
Leedehai wants to merge 2 commits intoKaTeX:mainfrom
Leedehai:derivatives

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

❌ Patch coverage is 93.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.98%. Comparing base (176552a) to head (7a3aee7).
⚠️ Report is 99 commits behind head on main.

Files with missing lines Patch % Lines
src/functions/utils/assembleDerivative.js 93.22% 4 Missing ⚠️
Additional details and impacted files

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           
Files with missing lines Coverage Δ
src/functions/genfrac.js 94.29% <100.00%> (+0.02%) ⬆️
src/functions/utils/assembleDerivative.js 93.22% <93.22%> (ø)

Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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!

@edemaine edemaine force-pushed the main branch 8 times, most recently from 9a985be to 0ef8921 Compare January 25, 2026 20:56
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