Giter Site home page Giter Site logo

mathlink.jl's Introduction

MathLink.jl

Build Status

This package provides access to Mathematica/Wolfram Engine via the MathLink library, now renamed to Wolfram Symbolic Transfer Protocol (WSTP).

Installation

The package requires an installation of either Mathematica or the free Wolfram Engine. It will attempt to find the installation at build time; if this fails, you will need to set the following environment variables:

  • JULIA_MATHKERNEL: the path of the MathKernel executable
  • JULIA_MATHLINK: the path of the MathLink dynamic library named
    • libML64i4.so/ libML32i4.so on Linux
    • libML64.dll/ libML32.dll on Windows
    • mathlink on macOS

Usage

The main interface consists of the W"" string macro for specifying symbols. These are call-overloaded for building more complicated expressions

julia> using MathLink

julia> W"Sin"
W"Sin"

julia> sin1 = W"Sin"(1.0)
W"Sin(1.0)"

julia> sinx = W"Sin"(W"x")
W"Sin"(W"x")

To parse an expression in the Wolfram Language, you can use the W cmd macro (note the backticks):

julia> W`Sin[1]`
W"Sin"(1)

weval evaluates an expression:

julia> weval(sin1)
0.8414709848078965

julia> weval(sinx)
W"Sin"(W"x")

julia> weval(W"Integrate"(sinx, (W"x", 0, 1)))
W"Plus"(1, W"Times"(-1, W"Cos"(1)))

Keyword arguments can be used to pass local variables

julia> weval(sinx; x=2.0)
0.9092974268256817

Notes

  • Mathematica, Wolfram, MathLink are all trademarks of Wolfram Research.

mathlink.jl's People

Contributors

alu96 avatar beastyblacksmith avatar juliatagbot avatar masonprotter avatar mikeinnes avatar scyrusm avatar simonbyrne avatar yingboma avatar

Stargazers

 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.