Skip to content

Instantly share code, notes, and snippets.

(ns strake
(:refer-clojure
:exclude [* + - / = abs compare denominator divide
infinite? numerator partial ref zero?])
(:require
[emmy.env :refer :all]
[emmy.leva :as leva]
[emmy.mathbox :as box]
[emmy.mathbox.plot :as plot]
(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*
(ns basic
(:refer-clojure
:exclude [+ - * / zero? compare divide numerator denominator
infinite? abs ref partial =])
(:require
[emmy.clerk :as ec]
[emmy.env :as e :refer :all]
[emmy.generic :as g]
[emmy.mafs :as mafs]
[emmy.viewer :as ev]
(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)
;; ## Visual Debugging!
;;
;; This notebook is a visual debugger for [this GitHub issue](https://github.com/mentat-collective/emmy/issues/174) in Emmy.
(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]))
@alexgian
alexgian / x-11device.part.scm
Created February 25, 2021 21:55
The X11 device primitives that MIT-Scheme makes available for graphing
;;;; X11 graphics device
(define (initialize-package!)
(set! x-graphics-device-type
(make-graphics-device-type
'x
`((available? ,x-graphics/available?)
(clear ,x-graphics/clear)
(close ,x-graphics/close-window)
(color? ,x-graphics/color?)
@alexgian
alexgian / S3-oop-tuples.R
Last active September 4, 2018 23:45
A trivial example of Sussman's up/down tuples in R (not recursive yet)
# use R OOP (S3) to implement up/down tuples
# (as per GJS and SICM)
library(purrr)
# constructor
new_Struct <- function(stype , vec){
stopifnot(is.character(stype)) # enforce up | down
stopifnot(is.vector(vec))
structure(vec,class="Struct", type=stype)
@alexgian
alexgian / extra_slib_guile-2.2.patch
Last active August 3, 2018 13:36
Patch to allow SLIB to work under Guile 2.0 (from Chris Vine - 2.0 won't work for 2.2 - use as appropriate)
;; extra patch for 2.2 from Chris Vine (the one below is not enough)
;; not tested yet
--- guile-2.init.20 2018-06-14 10:42:46.393772164 +0100
+++ guile-2.init 2018-06-14 10:43:51.672814892 +0100
@@ -171,8 +171,6 @@
provide
provided?))
-(define slib-module (current-module))
-
@alexgian
alexgian / poly.scm
Created June 14, 2018 03:40
JACAL's polynomial routines (Aubrey Jaffer-MIT)
;; JACAL: Symbolic Mathematics System. -*-scheme-*-
;; Copyright 1989, 1990, 1991, 1992, 1993, 1995, 1997 Aubrey Jaffer.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
@alexgian
alexgian / structures.rkt
Last active June 12, 2018 19:28
Implements the up/down tuple structured objects used by scmutils/SICM, for Racket
#lang racket
(require
srfi/1
math
racket/struct
;; syntax stuff
(for-syntax
syntax/parse
syntax/parse/lib/function-header))