-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path32-1.1 Symbolic mathematics with Sympy
1 lines (1 loc) · 2.86 KB
/
32-1.1 Symbolic mathematics with Sympy
1
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"32-1.1 Symbolic mathematics with Sympy","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyPJDS03Sj6NigbMSve6RnFh"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"code","metadata":{"id":"R4GVA8BNgY33"},"source":["# Symbolic mathematics with Sympy\n","# author: Gressling, T\n","# license: MIT License # code: github.com/gressling/examples\n","# activity: single example # index: 32-1 "],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"wowdScp_gppO","executionInfo":{"status":"ok","timestamp":1605974033089,"user_tz":-60,"elapsed":3870,"user":{"displayName":"Dr. Thorsten Gressling","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gjsy54zs1Pd2tw4fMBrz3a7FsYlzNHgwHWDqLywqA=s64","userId":"08619859847936335393"}},"outputId":"6c5d6558-e4ff-4295-baac-3295deabb132"},"source":["!pip install sympy"],"execution_count":2,"outputs":[{"output_type":"stream","text":["Requirement already satisfied: sympy in /usr/local/lib/python3.6/dist-packages (1.1.1)\n","Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.6/dist-packages (from sympy) (1.1.0)\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"q17shqbRgg4k","executionInfo":{"status":"ok","timestamp":1605974093416,"user_tz":-60,"elapsed":627,"user":{"displayName":"Dr. Thorsten Gressling","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gjsy54zs1Pd2tw4fMBrz3a7FsYlzNHgwHWDqLywqA=s64","userId":"08619859847936335393"}}},"source":["from sympy import symbols\n","from sympy.solvers import solve\n","\n","x, y = symbols('x y')"],"execution_count":6,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"a470ZWJtglGN","executionInfo":{"status":"ok","timestamp":1605974095202,"user_tz":-60,"elapsed":802,"user":{"displayName":"Dr. Thorsten Gressling","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gjsy54zs1Pd2tw4fMBrz3a7FsYlzNHgwHWDqLywqA=s64","userId":"08619859847936335393"}},"outputId":"a80537d4-3470-4ef3-b5a1-f225ab4207ea"},"source":["expr = x + 2*y\n","expr"],"execution_count":7,"outputs":[{"output_type":"execute_result","data":{"text/plain":["x + 2*y"]},"metadata":{"tags":[]},"execution_count":7}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"6Kd_cz3PgjlM","executionInfo":{"status":"ok","timestamp":1605974097107,"user_tz":-60,"elapsed":634,"user":{"displayName":"Dr. Thorsten Gressling","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gjsy54zs1Pd2tw4fMBrz3a7FsYlzNHgwHWDqLywqA=s64","userId":"08619859847936335393"}},"outputId":"be526f01-3a7c-4a3c-b716-0f54599d7384"},"source":["solve(x**2 - 2, x)"],"execution_count":8,"outputs":[{"output_type":"execute_result","data":{"text/plain":["[-sqrt(2), sqrt(2)]"]},"metadata":{"tags":[]},"execution_count":8}]}]}