Created
February 11, 2019 23:28
-
-
Save certik/448a7b18e567c2036068720feca00bcb 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": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Installation\n", | |
"\n", | |
"Install `xeus-cling`:\n", | |
"\n", | |
" conda install -c conda-forge xeus-cling" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#include <symengine/expression.h>\n", | |
"using SymEngine::Expression;" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"Expression x(\"x\");" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\left(x + \\sqrt{2}\\right)^{10}$" | |
], | |
"text/plain": [ | |
"(x + sqrt(2))**10" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"auto ex = pow(x+sqrt(Expression(2)), 10);\n", | |
"ex" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$32 + 160 \\sqrt{2} x + 960 \\sqrt{2} x^3 + 1008 \\sqrt{2} x^5 + 240 \\sqrt{2} x^7 + 10 \\sqrt{2} x^9 + 720 x^2 + 1680 x^4 + 840 x^6 + 90 x^8 + x^{10}$" | |
], | |
"text/plain": [ | |
"32 + 160*sqrt(2)*x + 960*sqrt(2)*x**3 + 1008*sqrt(2)*x**5 + 240*sqrt(2)*x**7 + 10*sqrt(2)*x**9 + 720*x**2 + 1680*x**4 + 840*x**6 + 90*x**8 + x**10" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"expand(ex)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "C++17", | |
"language": "C++17", | |
"name": "xeus-cling-cpp17" | |
}, | |
"language_info": { | |
"codemirror_mode": "text/x-c++src", | |
"file_extension": ".cpp", | |
"mimetype": "text/x-c++src", | |
"name": "c++", | |
"version": "-std=c++17" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment