A Clojure(script) implementation of the scmutils
system for math and physics investigations in the Clojure and Clojurescript languages.
.
1. To install Clojure in Ubuntu, just this command is enough:
sudo apt-get install elpa-cider
Although the Clojure version you get is probably not the most updated one, that is not important, because you can specify which version you want in the config file of each project.
.
2. Then use this command to generate a new project named my-stuff
:
lein new app my-stuff
.
3. Use Emacs
to open the file:
~/my-stuff/project.clj
.
4. Replace the existing :dependencies
line with this one
:dependencies [[org.clojure/clojure "1.11.1"]
[sicmutils "0.22.0"]]
And make sure that both clojure
and sicmutils
have the most updated version numbers.
.
5. In Emacs
, type the command
M-x cider-jack-in
.
6. In the clojure
window (cider-repl), type
(clojure-version)
with enter
at the end.
.
7. Type
(require '[sicmutils.env :as env])
.
8. Type
(env/bootstrap-repl!)
.
9. Code
((D cube) 'x)
will result
(+ (* x x) (* x (+ x x)))
.
10. Type the Emacs
command
M-p
to access the last input. Then modify it into
(simplify ((D cube) 'x))
.
It will result
(* 3 (expt x 2))
.
11. Code
(->TeX (simplify ((D cube) 'x)))
will give the
code
3\\,{x}^{2}
.
12. You can exit by the Emacs
command
<C-c C-q>
.
For the time being, SICMUtils
is not suitable for the book SICM (Structure and Interpretation of Classical Mechanics). In other words, SICMUtils
cannot replace the scmutils
library yet, because:
a. You would have to do the translation manually, from the scmutils
code in the book to SICMUtils
.
b. Although it can generate
source code, it does NOT do the
rendering.
c. It cannot plot graphs.
However, SICMUtils
has one advantage over scmutils
. It can generate
source of an expression, but scmutils
cannot. So I am planning to use both scmutils
and SICMUtils
.
Also, I will learn how to use SICMUtils
with other Clojure libraries and the Jupyter Notebook. That would get
rendering and graph plotting running.
— Me@2022-07-26 11:03:51 AM
.
.
2022.07.26 Tuesday (c) All rights reserved by ACHK
You must be logged in to post a comment.