Skip to content

The Laplacian, the Jacobian and the Hessian - #2190

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
the-laplacian-jacobian-and-hessian
Oct 28, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
the-laplacian-jacobian-and-hessian

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

laplacian, jacobian and hessian were reserved in #2184. They are now computed when parsed, as det is, into derivative nodes, so they need no node of their own. Part of #2182.

laplacian(f, [x, y, z]) the sum of the second derivatives of a scalar f
jacobian(F, [x, y]) a row for each component of F, a column for each variable; a scalar F is one row
hessian(f, [x, y]) entry (i, j) is the derivative in x_i of the derivative in x_j

The variables are a vector of distinct names, or one name. A set is refused, since it has no order to give the columns. So are a constant, a repeated name, and a vector given to laplacian or hessian. det(jacobian([r cos(t), r sin(t)], [r, t])) simplifies to r.

Input Was (2.6.0) Now
"laplacian(x^2 y + y^3, [x, y])".ToEntity().Simplify() throws UnhandledParseException 8 * y
"jacobian([x y, x + y], [x, y])".ToEntity().Simplify() throws UnhandledParseException [[y, x], [1, 1]]
"hessian(x^3 y^2, [x, y])".ToEntity().Simplify() throws UnhandledParseException [[6 * x * y ^ 2, 6 * x ^ 2 * y], [6 * x ^ 2 * y, 2 * x ^ 3]]

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 28, 2026
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.54%. Comparing base (7bb72a6) to head (b8b520e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2190   +/-   ##
=======================================
  Coverage   86.53%   86.54%           
=======================================
  Files         297      297           
  Lines       66324    66349   +25     
  Branches    19267    19273    +6     
=======================================
+ Hits        57396    57420   +24     
- Misses       4857     4859    +2     
+ Partials     4071     4070    -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.10% <100.00%> (+<0.01%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Sources/AngouriMath/Core/Antlr/AngouriMathLexer.cs 99.21% <100.00%> (+<0.01%) ⬆️
...ources/AngouriMath/Core/Antlr/AngouriMathParser.cs 87.58% <100.00%> (+0.08%) ⬆️
Sources/AngouriMath/Core/Antlr/ParsingHelpers.cs 92.94% <100.00%> (+2.77%) ⬆️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Rafael-SOWNet added a commit that referenced this pull request Oct 28, 2026
Complex.Conjugate was kept on the instance, made by Complex.Create under whatever downcasting
setting its first caller had. A division by a complex number conjugates the divisor, so a division
by i with the downcasting off left 0 - 1i, in decimals, as the conjugate of Complex.ImaginaryOne,
the one instance every i is. conj(i) was that for every caller after it, in every thread.

Two tests on #2190's branch failed in the full suite and passed alone: conj(i) against -i, and
MathS.Conjugate's documented example. Which ran first decided it.

The conjugate is now made each time it is asked for, under the setting in force, as every other
number is: the division that asks for it reads the modulus the same way (#1615). A regression test
divides by i with the downcasting off first; it fails without the change, with 0 - 1i.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet added a commit that referenced this pull request Oct 28, 2026
Complex.Conjugate was kept on the instance, made by Complex.Create under whatever downcasting
setting its first caller had. A division by a complex number conjugates the divisor, so a division
by i with the downcasting off left 0 - 1i, in decimals, as the conjugate of Complex.ImaginaryOne,
the one instance every i is. conj(i) was that for every caller after it, in every thread.

Two tests on #2190's branch failed in the full suite and passed alone: conj(i) against -i, and
MathS.Conjugate's documented example. Which ran first decided it.

The conjugate is now made each time it is asked for, under the setting in force, as every other
number is: the division that asks for it reads the modulus the same way (#1615). A regression test
divides by i with the downcasting off first; it fails without the change, with 0 - 1i.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
laplacian, jacobian and hessian were reserved by name in #2184 and are now computed when they are
parsed, as det is. Each is made of derivative nodes and needs no node of its own.

laplacian(f, [x, y, z]) is the sum of the second derivatives of a scalar f. jacobian(F, [x, y]) is
the matrix of the first derivatives of F's components, with a row for each component and a column
for each variable; a scalar F is one row. hessian(f, [x, y]) is the matrix of the second
derivatives of a scalar f, the entry in row i and column j being the derivative in x_i of the
derivative in x_j, as the definition writes it.

The variables are a vector of distinct names written out, or a single name. A set is refused,
having no order to give the columns, and so are a constant, a repeated name, and a vector or matrix
as the function of a Laplacian or a Hessian. det(jacobian([r cos(t), r sin(t)], [r, t]))
simplifies to r, and the Laplacian of 1/r vanishes in space.

The syntax page and the MCP server's syntax document describe them, and the native smoke test
evaluates two of them.

Part of #2182.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet
Rafael-SOWNet force-pushed the the-laplacian-jacobian-and-hessian branch from 3049a37 to b8b520e Compare October 28, 2026 23:12
@Rafael-SOWNet
Rafael-SOWNet merged commit e7b7fd0 into master Oct 28, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 28, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the the-laplacian-jacobian-and-hessian branch October 29, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant