Giter Site home page Giter Site logo

cneira / bld-maxima Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bld/bld-maxima

0.0 1.0 0.0 45 KB

Common Lisp interface to Maxima. Runs Maxima in batch mode, sending Maxima or lisp expressions to be evaluated, or spawns Maxima as a client and communicates with it over a socket.

License: MIT License

Common Lisp 100.00%

bld-maxima's Introduction

bld-maxima

BLD-MAXIMA runs a Maxima process in the background with a socket connection through with commands and Lisp math code can be sent for evaluation. It includes translation of Lisp math expressions to Maxima for algebraic simplification. Lisp forms that aren't in the translation table are identified and treated as symbols in Maxima. Depends on CL-PPCRE for translating Lisp -> Maxima -> Lisp. Currently, only SBCL is supported, using SB-EXT:RUN-PROGRAM to run Maxima in the background. This has been tested on both Win32 and Linux (both X86-64). The WITH-MAXIMA macro is provided to start & shutdown the Maxima process around whatever expressions are passed to it.

Routines

Allow running a single Maxima process and sending it commands or lisp math code to simplify over a network socket. Depends on USOCKET. Requires MAXIMA-START to run a socket connected Maxima session, and MAXIMA-SHUTDOWN once finished sending computations. Or, run inside WITH-MAXIMA macro.

Usage

CL-USER> (bld-maxima:maxima-start)
(((%I1) (%O1) FALSE)
 ((%I2) (%O2) "/usr/share/maxima/5.20.1/share/linearalgebra/linearalgebra.mac"))
CL-USER> (bld-maxima:simp '(+ (aref a 2) (aref a 2)))
(* 2 (AREF A 2))
16
CL-USER> (bld-maxima:maxima-shutdown)
T

Alternatively, you can run these routines inside the WITH-MAXIMA macro:

CL-USER> (with-maxima
            (simp '(+ a a)))
(* 2 A)
CL-USER> 

Also, trigonometric simplification functions are available corresponding to those in Maxima:

CL-USER> (with-maxima (trigreduce '(expt (cos x) 2)))
(* (/ 1 2) (+ 1 (COS (* 2 X))))
CL-USER> (with-maxima (trigexpand '(cos (* 2 x))))
(+ (EXPT (COS X) 2) (* -1 (EXPT (SIN X) 2)))
CL-USER> (with-maxima (trigsimp '(+ (expt (sin x) 2) (expt (cos x) 2))))
1

Delay

Wrapping the 'delay' macro around a 'simp expression prevents evaluation so it can be deferred until later, which can speed computations in certain circumstances because of the overhead incurred by 'simp.

bld-maxima's People

Contributors

bld avatar benpye avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.