Skip to content

Giac: fix calculus command argument slots - #25

Open
GliAcopo wants to merge 1 commit into
texmacs:masterfrom
GliAcopo:codex/giac-calculus-argument-slots
Open

Giac: fix calculus command argument slots#25
GliAcopo wants to merge 1 commit into
texmacs:masterfrom
GliAcopo:codex/giac-calculus-argument-slots

Conversation

@GliAcopo

@GliAcopo GliAcopo commented Sep 3, 2026

Copy link
Copy Markdown

Problem

Applying Giac → Calculus → Differentiate to selected structured mathematics immediately evaluated diff(expression) and gave no place to specify a differentiation variable. This is particularly unhelpful for multivariable expressions. Several neighboring calculus actions similarly constructed calls with fewer argument slots than their documented Giac forms.

Reproduction

  1. Enter ln(sqrt(x^2 + z^2) + z) as TeXmacs mathematics.
  2. Select it.
  3. Choose Giac → Calculus → Differentiate.

Previously, the menu used arity 1, so TeXmacs took the immediate-evaluation path for diff(selection). The expected interaction is an editable diff(selection, …) operation where z can be entered.

Root cause

giac-apply delegates non-session operations to TeXmacs' generic script-apply. Its arity controls both the generated argument slots and whether a selected unary operation is evaluated immediately. The Giac Calculus menu supplied unary or otherwise incomplete arities for several commands.

Implementation

Use the practical documented arity for each Calculus action:

  • two arguments for differentiation, integration, gradient, divergence, curl, Hessian, Laplacian, extrema, convexity, Taylor, and series;
  • three for limits and implicit differentiation.

Optional higher-order, bounded, directional, or constrained forms remain editable by users without expanding this into a command redesign.

Examples

The differentiation action now supports diff(x^2,x), diff(x*y,x), diff(x*y,y), and diff(ln(sqrt(x^2+z^2)+z),z).

Validation

  • Parsed the updated Scheme file with Guile.
  • Checked the diff for whitespace errors.
  • Verified all updated menu mappings and arities.
  • Exercised the selection-to-editable-script flow in TeXmacs 2.1.4 with the patched plugin.
  • Evaluated representative forms for every changed command with Giac 1.9.0.
  • Confirmed the logarithmic derivative is algebraically equivalent to 1/sqrt(x^2+z^2).

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.

1 participant