Created
November 23, 2017 11:27
-
-
Save goropikari/4b74cb8b087a5ac3131b003ebda8c41b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"using Latexify" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"\\begin{align}\n", | |
"\\frac{dx}{dt} =& y^{2} - x \\\\ \n", | |
"\\frac{dy}{dt} =& \\frac{x}{y} - y \\\\ \n", | |
"\\end{align}\n" | |
], | |
"text/plain": [ | |
"\"\\\\begin{align}\\n\\\\frac{dx}{dt} =& y^{2} - x \\\\\\\\ \\n\\\\frac{dy}{dt} =& \\\\frac{x}{y} - y \\\\\\\\ \\n\\\\end{align}\\n\"" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"lhs = [\"dx/dt\", \"dy/dt\"]\n", | |
"rhs = [\"y^2 - x\", \"x/y - y\"]\n", | |
"latexalign(lhs, rhs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\\begin{align}\n", | |
"\\frac{dx}{dt} =& y^{2} - x \\\\ \n", | |
"\\frac{dy}{dt} =& \\frac{x}{y} - y \\\\ \n", | |
"\\end{align}\n" | |
] | |
} | |
], | |
"source": [ | |
"print(latexalign(lhs, rhs))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"\\begin{equation}\n", | |
"\\left[\n", | |
"\\begin{array}{cc}\n", | |
"1 & 2\\\\ \n", | |
"3 & 4\\\\ \n", | |
"\\end{array}\n", | |
"\\right]\n", | |
"\\end{equation}\n" | |
], | |
"text/plain": [ | |
"\"\\\\begin{equation}\\n\\\\left[\\n\\\\begin{array}{cc}\\n1 & 2\\\\\\\\ \\n3 & 4\\\\\\\\ \\n\\\\end{array}\\n\\\\right]\\n\\\\end{equation}\\n\"" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"arr = [1 2; 3 4]\n", | |
"latexarray(arr)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\\begin{equation}\n", | |
"\\left[\n", | |
"\\begin{array}{cc}\n", | |
"1 & 2\\\\ \n", | |
"3 & 4\\\\ \n", | |
"\\end{array}\n", | |
"\\right]\n", | |
"\\end{equation}\n" | |
] | |
} | |
], | |
"source": [ | |
"print(latexarray(arr))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"using ParameterizedFunctions" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"\\begin{align}\n", | |
"\\frac{dx}{dt} =& \\frac{v \\cdot y^{n}}{k^{n} + y^{n}} - x \\\\ \n", | |
"\\frac{dy}{dt} =& \\frac{x}{k_{2} + x} - y \\\\ \n", | |
"\\end{align}\n" | |
], | |
"text/plain": [ | |
"\"\\\\begin{align}\\n\\\\frac{dx}{dt} =& \\\\frac{v \\\\cdot y^{n}}{k^{n} + y^{n}} - x \\\\\\\\ \\n\\\\frac{dy}{dt} =& \\\\frac{x}{k_{2} + x} - y \\\\\\\\ \\n\\\\end{align}\\n\"" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"f = @ode_def positiveFeedback begin\n", | |
" dx = v*y^n/(k^n+y^n) - x\n", | |
" dy = x/(k_2+x) - y\n", | |
"end v=>1.0 n=>1.0 k=>1.0 k_2=>1.0\n", | |
"latexalign(f)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\\begin{align}\n", | |
"\\frac{dx}{dt} =& \\frac{v \\cdot y^{n}}{k^{n} + y^{n}} - x \\\\ \n", | |
"\\frac{dy}{dt} =& \\frac{x}{k_{2} + x} - y \\\\ \n", | |
"\\end{align}\n" | |
] | |
} | |
], | |
"source": [ | |
"print( latexalign(f) )" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Julia 0.6.1", | |
"language": "julia", | |
"name": "julia-0.6" | |
}, | |
"language_info": { | |
"file_extension": ".jl", | |
"mimetype": "application/julia", | |
"name": "julia", | |
"version": "0.6.1" | |
}, | |
"toc": { | |
"nav_menu": {}, | |
"number_sections": true, | |
"sideBar": true, | |
"skip_h1_title": false, | |
"toc_cell": false, | |
"toc_position": {}, | |
"toc_section_display": "block", | |
"toc_window_display": false | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment