{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import sympy as sm\n", "a, b, th, gama, x, t, y, z = sm.symbols(\"a, b, theta, gamma, x, t, y, z\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(a, b, theta, gamma, x, t, y, z)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a, b, th, gama, x, t, y, z\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "f" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f = sm.Function('f')\n", "f" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\sin{\\left(f{\\left(t \\right)} \\right)} - \\frac{\\tan{\\left(\\frac{a}{b} \\right)}}{\\log{\\left(\\gamma \\right)}}$" ], "text/plain": [ "sin(f(t)) - tan(a/b)/log(gamma)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expr3 = sm.sin(f(t)) - sm.tan(a/b)/sm.log(gama)\n", "expr3" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\frac{2 a \\left(\\tan^{2}{\\left(\\frac{a}{b} \\right)} + 1\\right) \\tan{\\left(\\frac{a}{b} \\right)}}{b^{3} \\log{\\left(\\gamma \\right)}} + \\frac{\\tan^{2}{\\left(\\frac{a}{b} \\right)} + 1}{b^{2} \\log{\\left(\\gamma \\right)}}$" ], "text/plain": [ "2*a*(tan(a/b)**2 + 1)*tan(a/b)/(b**3*log(gamma)) + (tan(a/b)**2 + 1)/(b**2*log(gamma))" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "part1 = sm.diff(expr3, a)\n", "part2 = sm.diff(part1, b)\n", "part2" ] } ], "metadata": { "kernelspec": { "display_name": "blade", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.16" } }, "nbformat": 4, "nbformat_minor": 2 }