Skip to content

Instantly share code, notes, and snippets.

@alexgian
Last active June 4, 2024 08:39
Show Gist options
  • Select an option

  • Save alexgian/71b77b05f127c3a42f04b576239a1eaa to your computer and use it in GitHub Desktop.

Select an option

Save alexgian/71b77b05f127c3a42f04b576239a1eaa to your computer and use it in GitHub Desktop.
(ns param.example
(:require [emmy.complex :as complex]
[emmy.env :as e :refer :all]
[emmy.mafs :as mafs]
[emmy.mathbox.plot :as plot]
[emmy.viewer :as ev]))
;; Intersection of two inequalities.
;;
;; (note blended color in area of intersection)
(ev/with-let
[!point [-2 -2]]
(mafs/mafs
(mafs/cartesian)
(mafs/inequality
(let [xle (ev/with-params
{:atom !point :params [0 1]}
(fn [ax ay]
(fn [y]
(- (cos (+ y ay)) ax))))
xgt (ev/with-params
{:atom !point :params [0 1]}
(fn [ax ay]
(fn [y]
(+ (sin (- y ay)) ax))))]
{:x {:<= xle :> xgt} :color :blue}))
(mafs/inequality
(let [yle (ev/with-params
{:atom !point :params [0 1]}
(fn [ax ay]
(fn [x]
(- (cos (+ x ax)) ay))))
ygt (ev/with-params
{:atom !point :params [0 1]}
(fn [ax ay]
(fn [x]
(+ (sin (- x ax)) ay))))]
{:y {:<= yle :> ygt} :color :pink }))
(mafs/movable-point {:atom !point}) ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment