Skip to content

docs(notebooks): modernise symbolic.ipynb for the current API and make it fast to run - #857

Merged
petercorke merged 3 commits into
mainfrom
docs/notebook-symbolic
Oct 19, 2026
Merged

petercorke merged 3 commits into
mainfrom
docs/notebook-symbolic

Conversation

@petercorke

@petercorke petercorke commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Notebook renovation, symbolic.ipynb. It could not be run to the end against main (a simplify cell ran for minutes, one cell had a syntax error, and print(puma) raised an error); it now runs end to end in about 25 s with no errors. No change to the toolbox. It needs #856 (print(robot) for a symbolic robot) to be merged first.

What changed

  • Gravity. puma.gravity = [0, 0, g] is now [0, 0, -g]: with the current convention gravity is the acceleration due to gravity (default [0, 0, -9.81]).

  • Timing. The symbolic inverse dynamics (rne_python) now takes 0.14 s, not "10 minutes or more", and the prose says so. The six simplify(tau[j]) cells are replaced by one for tau[5] (1 s), and a note says how long the others take (measured here: 14 s for tau[3], 48 s for tau[4], over 150 s for tau[2]).

  • tau is a NumPy object array, not a SymPy matrix as the prose said; the prose is corrected, and the gravity substitution (tau.subs does not exist on an array) is [t.subs(subsdict) for t in tau].

  • The coefficient cells used the unexpanded tau[0], so .coeff(...) returned empty tuples; they now use the expanded tau_0, and the squared velocity term is tau_0.coeff(qd[0], 2). One of them was a code line in a markdown cell, now a code cell.

  • The threshold for the significant terms is 1e-2 and not 1e-6: with 1e-6, 5470 of the 5533 terms survive, and 1e-2 leaves 25%, which is what the prose says.

  • A cell with a syntax error (an unfinished subsdict loop) is completed, and empty cells are removed.

  • The standard generated first cell (docs(notebooks): a standard generated first cell, and a shorter bootstrap cell #850) with the modernised note.

  • It now asks for the ik extra in its metadata (rtb_bootstrap.extras), so that the bootstrap installs SymPy in the browser. Its old piplite cell did not install SymPy, so it probably never worked in JupyterLite.

Executed headless against the code of #856 (0 error cells, 25 s). Not tried in a browser. Written with AI assistance (Claude Code).

🤖 Generated with Claude Code

petercorke and others added 2 commits October 19, 2026 18:41
…e it fast to run

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… SymPy in the browser

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke enabled auto-merge (squash) October 19, 2026 08:41
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7666c63) to head (e8eba70).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #857   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines      16867   16867           
=====================================
  Misses     16867   16867           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@petercorke
petercorke merged commit bd9e933 into main Oct 19, 2026
23 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
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