8000 GitHub - digikar99/py4cl2 at v2.2.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

digikar99/py4cl2

Repository files navigation

This is a fork of bendudson/py4cl.

Github Pages

Detailed documentation is available on github-pages (could be a bit outdated).

Releases

Check the Releases section.

Quick Demonstration

(ql:quickload :py4cl2 :silent t)

(py4cl2:defpymodule "numpy" nil :lisp-package "NP")
(py4cl2:defpymodule "scipy.integrate" nil :lisp-package "INTEGRATE")

;; Integrate some ODEs
(defparameter *data*
  (integrate:odeint 
   :func (lambda (y time) 
           (list (aref y 1)       ; dy[0]/dt = y[1]
                 (- (aref y 0)))) ; dy[1]/dt = -y[0]
   :y-0 #(1.0 0.0)   ; Initial state
   :t (np:linspace :start 0.0 :stop (* 2 pi) :num 20)))
                                        ; Vector of times

; (array-dimensions *data*) => (20 2)

;; Make a plot, save and show it in a window
(py4cl2:defpymodule "matplotlib.pyplot" nil :lisp-package "PLT")

(plt:plot *data*)
(plt:xlabel "Time")
(plt:savefig "result.pdf")
(plt:show)

Great thanks to Ben Dudson for starting this project, and documenting it enough to make it more-buildable!

0