Skip to content

Instantly share code, notes, and snippets.

@sn6uv
Created January 12, 2014 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sn6uv/8381447 to your computer and use it in GitHub Desktop.
Save sn6uv/8381447 to your computer and use it in GitHub Desktop.
IMathics Demo
{
"metadata": {
"name": "Mathics Demo"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": "An IMathics Preview\n===================\nThis notebook is a demo of IMathics: A [Mathics](http://mathics.org) backend combined with the [IPython](http://ipython.org/) interactive environment.\n\nBasics\n------\nBasic queries of the Mathics Backend:"
},
{
"cell_type": "code",
"collapsed": false,
"input": "Solve[Cos[x^2] == 1, x]",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 1,
"text": "{{x -> 0}, {x -> -Sqrt[Pi] Sqrt[2]}, {x -> Sqrt[Pi] Sqrt[2]}}"
}
],
"prompt_number": "*"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "You can define multiline expressions too"
},
{
"cell_type": "code",
"collapsed": false,
"input": "x = 2\nIf[x == 1,\n x = 3,\n x = 5]\nx+1",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"text": "2"
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": "5"
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"text": "6"
}
],
"prompt_number": "*"
},
{
"cell_type": "code",
"collapsed": false,
"input": "N[Pi/7, 100]",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"text": "0.4487989505128276054946633404685004120281670570535865458535635131868309151837441426611478321917310099"
}
],
"prompt_number": "*"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "There is even support for basic errors reporting"
},
{
"cell_type": "code",
"collapsed": false,
"input": "Log[1.5)",
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "General::syntax",
"evalue": "Parse error at or near token ).",
"output_type": "pyerr",
"traceback": [
"General::syntaxParse error at or near token )."
]
}
],
"prompt_number": "*"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Graphics to come soon!"
},
{
"cell_type": "code",
"collapsed": false,
"input": "Plot[Sin[x], {x, -5, 5}]",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": "-Graphics-"
}
],
"prompt_number": "*"
},
{
"cell_type": "code",
"collapsed": false,
"input": "Plot3D[Sin[x y^2], {x, -5, 5}, {y, -5, 5}]",
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 7,
"text": "-Graphics3D-"
}
],
"prompt_number": "*"
},
{
"cell_type": "code",
"collapsed": false,
"input": "",
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment