Last active
September 26, 2024 11:14
-
-
Save alexgian/9fd4975eb2d868d1063209e1ae3d22e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns param-2D | |
| (:require | |
| [emmy.env :as e :refer :all] | |
| [emmy.generic :as g] | |
| [emmy.mafs :as mafs] | |
| [emmy.leva] | |
| [emmy.viewer :as ev] | |
| )) | |
| ;; ## Parametric equations with *mafs* | |
| (defn param_eqn_1 [a] | |
| (fn [t] | |
| [(* a (- t (sin t))) | |
| (* a (- 1 (cos t)))])) | |
| (ev/with-let | |
| [!coeffs {:a 1 :x 0}] | |
| (let [x (* pi 16)] | |
| (mafs/mafs | |
| (emmy.leva/controls | |
| {:folder {:name "cycloid"} | |
| :schema | |
| {:a {:min 0.1 :max 3 :step 0.05} | |
| :x {:min -1 :max 20 :step 0.05} | |
| } | |
| :atom !coeffs}) | |
| (mafs/cartesian) | |
| (mafs/parametric {:xy | |
| (ev/with-params | |
| {:atom !coeffs | |
| :params [:a]} | |
| param_eqn_1) | |
| :t [0 (* 16 pi)] | |
| :color "#43CC50EB" | |
| }) | |
| (mafs/circle {:center [0 1] :radius 1 :color :yellow :opacity 0}) | |
| ))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment