Along those lines, I have another Clerk demo, this...
# share-your-work
s
Along those lines, I have another Clerk demo, this time with interactive animations of physical systems powered by a state of the art ODE solver that lives in the browser. For this “viewer”, given a Lagrangian (basically a function from some description of a system => kinetic minus potential energy, a SCALAR), the viewer is able to figure out how to physically animate the system. This is bonkers stuff. Here is a Twitter thread with a link to three videos: https://twitter.com/sritchie/status/1503220063264026629
❤️ 2
k
Excellent. That's the most convincing demo so far for physicists who don't fundamentally care much about programming. I don't know any platform other than Mathematica that could do this - and you can't really share Mathematica with your students.
👍 1
j
@Konrad Hinsen 💯 which reminds me that when it first came out I had to un-license key Mathematica (by editing the binary with emacs to NOP the JMP to the license check) because their approach to copy protection broke running the binary over an NFS mount 😹
😿 1
👍 1
o
This was super compelling! I’m really interested in the interactive animations and physics here, but I’d actually love to know more about the TeX integration. Is there somewhere I can read more about that? I’ve only done a little Clojure so maybe it’s nothing novel, but goddamn would I love to have tighter TeX integration in my day-to-day work.
s
@Orion Reed great question; one goal of this project is to NOT present a big monolithic thing, but a fissionable artifact where folks can make off with individual components. SO in that spirit the TeX rendering is definitely independent. On the clojure side, there are three main ideas that work together for TeX: 1. the sicmutils library ships generic versions of functions like
+
,
-
,
*
,
/,
, all the trig operators,
transpose
, etc etc, and those functions are overloaded for (among other types) numbers and symbolic math. Symbolic math operations simply build up a clojure expression tree, like
(+ (sin x) (expt (cos x) 3))
2. the library also contains a powerful simplifier that can transform tree => simplified tree… 3. There there is a -TeX> function that can turn this expression into a string of TeX. When you use Clerk to show TeX, it uses
->TeX
and then points katex or mathjax at the resulting string. There are some other fun features of
->TeX
, like, if a symbol is named after a greek letter it gets shown as greek.
'x_1
, underscores, show up an subscripts, and superscripts work too;
❤️ 1
@Orion Reed ACTUALLY check this out: https://nextjournal.com/try/samritchie/sicmutils/
the library can also run in Nextjournal fully in the browser, forget all this hybrid clerk stuff 🙂 scroll down a bit and you can see examples of TeX generation:
@Orion Reed if there’s more tuneability you want (almost guaranteed) let’s talk, I fully agree that the ability to write TeX with something more lispy than
\the{usual}
, without any ceremony, would be REALLY valuable beyond physics etc
o
@Sam Ritchie this is really really cool! I’m going to have to dig more into this, interested to find out where its limits/weak points are. And yeah, this feels close to something I could write without referencing a cheatsheet and a lot more idiomatic to the actual math I want to represent, instead of being wrapped in typesetting jargon. It also seems like an interesting intermediate representation that would be easier to work with than TeX itself.
s
👍 well let’s keep talking, here or in a Github Discussion on https://github.com/sicmutils/sicmutils if a specific project like, for example, “I want to use ->TeX without thinking about Clojure, from this editor” etc comes to mind
💯 1
k
This sounds like the beginning of Markdown but for LaTeX. Go ahead! 🙂
🙂 1
💯 2