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

Migrate sicmutils => emmy, add bug repros #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sritchie
Copy link
Contributor

This PR:

  • Migrates the sicmutils notebook over to Emmy. This uses our new function compilation (still clunky), which brings the notebook evaluation down under 1s.
  • Adds an emmy-repro namespace with the two big current bugs that will cause trouble for the conj presentation. The main one is that including any code at all that uses a function from sicmutils.env causes the clerk evaluation time to spike.
(ns emmy-repro
  (:require [emmy.env :as e]
            [emmy.mechanics.lagrange]))

;; ## BUG 1:

;; This notebook takes close to 2 seconds to evaluate:

;; Clerk evaluated '/Users/sritchie/code/clj/clerk-demo/notebooks/emmy_repro.clj' in 1853.674042ms.

;; Form the final Langrangian in generalized coordinates (the angles of each
;; segment) by composing `L-rect` with a properly transformed `angles->rect`
;; coordinate transform!

;; ## BUG 2:
;;
;; The following form:

#_
(let [L (emmy.mechanics.lagrange/L-pendulum 'g 'm 'l)]
  (((e/Lagrange-equations L)
    (e/literal-function 'theta_1))
   't))

;; Evaluates to this:
(e/literal-number
 '(- (* 1/2 m 2 l (((expt D 2) theta_1) t) l) (* g m l (- (sin (theta_1 t))))))


;; But if I include it in a notebook, I get this:

;; Execution error (NullPointerException) at clojure.tools.analyzer.jvm.utils/members* (utils.clj:272).
;; Cannot invoke "java.lang.Class.getName()" because the return value of "clojure.lang.IFn.invoke(Object)" is null

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