{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3.9 Trig functions, logs, power, reciprocals and integrals"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# import all python add-ons etc that will be needed later on\n",
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from sympy import *\n",
"init_printing() # allows printing of SymPy results in typeset maths format\n",
"plt.rcParams.update({'font.size': 14}) # set font size for plots"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3.9 Differentiating sine and cosine\n",
"\n",
"Sine and cosine functions are almost mirror images of one another when differentiated,\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\sin(x)=\\cos(x) \\qquad \\frac{d}{dx}\\cos(x)=-\\sin(x) \\qquad\\tag{9}$$\n",
"\n",
"which makes sense if one inspects a graph of these functions, see Fig. 5. The value of the cosine at any point is the gradient of the sine at that point and the gradient of the cosine is $-1$ times the value of the sine. When the sine has its maximum or minimum, where the gradient is zero, the value of the cosine is also zero. Furthermore, when the gradient of the sine is positive, $x/\\pi = 0 \\to 1/2$ and also $3/2 \\to 2$, the value of the cosine, which is the derivative, is positive. When the gradient of the sine is negative, the value of the cosine is negative. It is therefore not surprising that on differentiating these functions again they turn into one another but with a change of sign depending upon how many times this is done.\n",
"\n",
"$$\\displaystyle \\begin{align} \\frac{d}{dx}\\sin(ax)&=a\\cos(a)\\\\\n",
"\\frac{d^2}{dx^2}\\sin(ax)&=a\\frac{d}{dx}\\cos(a)=-a^2\\sin(ax) \\\\\n",
"\\frac{d^3}{dx^3}\\sin(ax)&=-a^3\\cos(ax)\\\\\n",
"\\frac{d^4}{dx^4}\\sin(ax)&=a^4\\sin(ax)\\\\\n",
"\\end{align}$$\n",
"\n",
"the pattern being $ +\\cos,\\; -\\sin,\\; -\\cos,\\; +\\sin \\cdots$ with the powers of $a$ increasing each time.\n",
"\n",
"![Drawing](differen-fig5.png)\n",
"\n",
"Figure 5. Sine and cosine over two periods.\n",
"______\n",
"\n",
"## 3.10 Other trig functions, tan, sec and hyperbolic functions sinh, cosh and their inverse.\n",
"\n",
"There are many other trigonometric and closely related hyperbolic functions besides sine and cosine, and most can be treated by the differentiation methods described in the next few sections based on basic differentiation. One useful way is to convert to the exponential form first. Sine and cosine can easily be differentiated this way, then converted back to a trig form. A tangent, for example, is the ratio of sine/cosine and is treated as a ratio. Others functions such as sec(x) which is 1/cos(x) can be treated as a function of a function, Section 5.1, either in the trig or exponential form. The hyperbolic functions cosh, sinh, and tanh also have exponential representations. \n",
"\n",
"The inverse functions $\\displaystyle y=\\sin^{−1}(x),\\; y = \\cosh^{-1}(x)$, and so forth can be treated by rearranging the equation, for instance,\n",
"\n",
"$$\\displaystyle y=\\sin^{-1}(x^2) \\qquad \\to \\qquad \\sin(y)=x^2$$\n",
"\n",
"and differentiating both sides (see eqn. 6 ), produces, $\\displaystyle \\cos(y)\\frac{dy}{dx}=2x$ and $y$ can be substituted into this using $\\displaystyle \\cos^2(x)+\\sin^2(y)=1$ giving\n",
"\n",
"$$\\displaystyle \\cos(y)=\\sqrt{1-\\sin^2(y)}=\\sqrt{1-x^4}$$\n",
"\n",
"The final result is \n",
"\n",
"$$\\displaystyle \\frac{dy}{dx}=\\frac{2x}{\\sqrt{1-x^4}}$$\n",
"\n",
"The Pythagoras right-angled triangle can also be used to convert between trig functions. See Chapter 1.5 and a table of many functions is given in section 4.17.\n",
"\n",
"## 3.12 Differentiating logarithms\n",
"\n",
"In a 1697 paper Johann Bernoulli states ( Dunham 2018), \n",
"\n",
">'The differential of a logarithm, no matter how composed, is equal to the differential of the expression divided by the expression' \n",
"\n",
"thus differentiating logarithms always has the form: \n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\ln\\left( f(x) \\right)=\\frac{f'(x)}{f(x)} \\quad \\text{where }\\quad f' =\\frac{d}{dx} \\qquad\\tag{10} $$\n",
"\n",
"for example,\n",
"\n",
"$$\\displaystyle \\begin{align}\\frac{d}{dx}\\ln(x)&=\\frac{1}{x}\\\\ \\frac{d}{dx}\\ln\\left(\\sin(x)\\right)&=\\frac{\\cos(x)}{\\sin(x)}=\\frac{1}{\\tan(x)}\\end{align}$$\n",
"\n",
"Differentiating $\\ln(y)$ with respect to $x$ produces a most useful form, which is worth remembering\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\ln(y)=\\frac{1}{y}\\frac{dy}{dx} \\qquad\\tag{11}$$\n",
"\n",
"**(a)** The van't Hoff equation of chemical thermodynamics has this last form, \n",
"\n",
"$$\\displaystyle \\frac{d\\ln(K_p)}{dT}=\\frac{\\Delta_rH^{\\mathrm{o}}}{RT^2}$$\n",
"\n",
"This equation describes the change of an equilibrium constant $K_p$ for a reaction carried out at constant pressure with temperature $T$ and quantifies the Le Chatelier principle. $\\Delta_rH^{\\mathrm{o}}$ is the standard molar enthalpy of the reaction. In this form it is easier to plot or integrate wrt.temperature.\n",
"\n",
"**(b)** A particularly cunning and somewhat complicated example using this log derivative is to solve the equation\n",
"\n",
"$$\\displaystyle R\\frac{d^2S}{dx^2}+2\\frac{dR}{dx}\\frac{dS}{dx}=0$$\n",
"\n",
"where both $R$ and $S$ are functions of $x$. The first step is to divide by $R$ and then to use the form of equation 11 on the derivative in $R$.\n",
"\n",
"$$\\displaystyle \\frac{d^2S}{dx^2}+\\frac{2}{R}\\frac{dR}{dx}\\frac{dS}{dx}=0,\\quad\\to\\quad \\frac{d^2S}{dx^2}+2\\frac{d\\ln(R)}{dx}\\frac{dS}{dx}=0$$\n",
"\n",
"Now suppose we substitute $U =dS/dx$ then $dS^2/dx^2\\equiv dU/dx$,\n",
"\n",
"$$\\displaystyle \\frac{dU}{dx}+2\\frac{d\\ln(R)}{dx}U=0$$\n",
"\n",
"and then divide by $U$ and use eqn 11, substitute back and simplifying gives\n",
"\n",
"$$\\displaystyle \\frac{d\\ln(U)}{dx}+2\\frac{d\\ln(R)}{dx}=0\\quad\\to\\quad \\frac{d}{dx}\\left( \\ln\\left(\\frac{dS}{dx}\\right)+\\ln(R^2)\\right)=0 $$\n",
"\n",
"The solution is \n",
"\n",
"$$\\displaystyle \\frac{dS}{dx}=\\frac{C}{R^2}$$\n",
"\n",
"where $C$ is a constant. The reason $C$ is there is that this is the general form and is simplified from the derivative of a log, since $\\displaystyle \\frac{d}{dx}\\ln(Cx)=\\frac{1}{x}$. \n",
"\n",
"**(c)** The product $\\displaystyle \\prod_{n=1}^\\infty \\left(1-\\frac{x^2}{n^2}\\right)$ cannot be easily differentiated but its log can be and so\n",
"\n",
"$$\\displaystyle \\log\\left( \\prod_{n=1}^\\infty \\left(1-\\frac{x^2}{n^2}\\right) \\right)= \\sum_{n=1}^\\infty \\log\\left(1-\\frac{x^2}{n^2}\\right)$$\n",
"\n",
"and \n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\sum_{n=1}^\\infty \\log\\left(1-\\frac{x^2}{n^2}\\right)= -\\sum_{n=1}^\\infty\\frac{2x}{n^2-x^2}$$\n",
"\n",
"\n",
"\n",
"## 3.13 Differentiating $x$ as a power, factorials $x!$ and absolute values $|x|$ \n",
"\n",
"Expressions such as $y=a^x,\\;y=x^{1/x},\\; y= x^x $ etc. can be differentiated quite easily with a little care.\n",
"\n",
"### **(i) $a^x$**\n",
"In cases where there are powers of $x$ it is best to take logs of both sides first. For example,\n",
"if $y = a^x$, taking logs of both sides gives $\\ln(y) = x \\ln(a)$ and differentiating produces\n",
"\n",
"$$\\displaystyle \\frac{1}{y}\\frac{dy}{dx}=\\ln(a) \\qquad\\tag{12}$$\n",
"\n",
"and simplifying produces \n",
"\n",
"$$\\displaystyle \\frac{dy}{dx}=y\\ln(a)=a^x\\ln(a)$$\n",
"\n",
"In the special case that $a = e$ ($e$ is the exponential constant), then the exponential derivative is retrieved because $\\ln(e) = 1$.\n",
"\n",
"\n",
"### **(ii) Which is larger $e^\\pi$ or $\\pi^e$ ?**\n",
"As a second example we differentiate $x^{1/x}$ and from this we can determine which is larger $e^\\pi$ or $\\pi^e$ in other words is $e^\\pi >\\pi^e$ or not. Taking logs of both side gives $\\pi\\ln(e)>e\\ln(\\pi)$, and dividing by $e$ and $\\pi$ gives $\\displaystyle \\frac{\\ln(e)}{e}>\\frac{\\ln(\\pi)}{\\pi}$ thus the test to make is to see if $\\displaystyle e^{1/e}>\\pi^{1/\\pi}$ or not. If the maximum of $x^{1/x}$ can be found then we determine if the inequality is true or not.\n",
"\n",
"First take logs giving $\\displaystyle \\ln(y)=\\frac{1}{x}\\ln(x)$ and then differentiate and using eqn. 11 to simplify gives\n",
"\n",
"$$\\displaystyle \\frac{1}{y}\\frac{dy}{dx}= \\frac{1}{x^2}-\\frac{1}{x^2}\\ln(x)\\quad\\to\\quad \\frac{dy}{dx}=\\frac{x^{1/x}}{x^2}(1-\\ln(x))$$\n",
"\n",
"To determine which is bigger $e^\\pi$ or $\\pi^e$ means that we should compare $e^{1/e}$ and $\\pi^{1/\\pi}$. The thing to realize here is that if we find the maximum of the derivative of $x^{1/x}$ we can then check which of our two terms is bigger. To find the minimum/maximum is very simple (see section 9) and is found by setting the derivative to zero, then $\\ln(x)=1$ so that $x=e$ is the _global maximum_ and this means that $e^{1/e}$ is the maximum possible value and so $e^\\pi\\; \\gt\\; \\pi^e$. The graph of $\\displaystyle x^{1/x}$ is zero at $x=0$, rises rapidly then decreases again as $x$ increases.\n",
"\n",
"### **(iii) Factorials** \n",
"A factorial is defined as $x!=x\\cdot(x-1)\\cdot (x-2)\\cdots 2\\cdot 1$ where $x$ is an integer, thus this function cannot be differentiated. Factorials occur most commonly in evaluating probabilities such as the binomial coefficients \n",
"\n",
"$$\\displaystyle \\binom{n}{x}=\\frac{n!}{x!(n-x)!}$$\n",
"\n",
"and sometimes it is necessary to determine the maximum of a distribution containing this term, which thus requires differentiation. \n",
"\n",
"Fortunately, for large $x$ Stirling's Rule can be used which is \n",
"\n",
"$$\\displaystyle x! \\approx x^xe^{-x}\\qquad \\text{or}\\qquad \\ln(x!)=x\\ln(x)-x$$\n",
"\n",
"where $x$ is assumed not to be an integer but a variable. Differentiating the log produces \n",
"\n",
"$$\\displaystyle \\frac{d\\,\\ln\\,x!}{dx}=\\frac{1}{x!}\\frac{d x!}{dx}=\\ln(x). \\qquad \\frac{dx!}{dx}=x!\\ln(x)$$\n",
"\n",
"To find the maximum in $\\displaystyle \\binom{n}{x}\\equiv y=\\frac{n!}{x!(n-x)!}$,\n",
"\n",
"substitute for the factorials using Stirling's formula, differentiate and set the result to zero. \n",
"\n",
"$$\\displaystyle \\begin{align} \\ln(y)& = n\\ln(n) - x\\ln(x) -(n-x)\\ln(n-x) \\\\\n",
"\\frac{1}{y}\\frac{dy}{dx}&=-\\ln(x) +\\ln(n-x) \\end{align} $$\n",
"\n",
"substituting for $y$ produces \n",
"\n",
"$$\\displaystyle\\frac{dy}{dx}=\\frac{n!}{x!(n-x)!}(-\\ln(x) +\\ln(n-x) )$$\n",
"\n",
"and the maximum (or minimum) is found when the derivative is zero which can only be when $\\ln(x)=\\ln(n-x)$ or $x=n/2$. This can only be a maximum because the distribution is always positive and can be confirmed by direct calculation or plotting values. See Pascal's triangle and Binomial distribution in Chapters 1 and 12.\n",
"\n",
"The derivative of any factorial can be evaluated using the Gamma function (see Chapter 1-8). The Gamma function produces factorials of any number, positive or negative, not just integers. Using $(x-1)!=\\Gamma(x)$ the formula for the derivative $\\Gamma'(x)$ is\n",
"\n",
"$$\\displaystyle \\Gamma'(x)=\\Gamma(x)\\left(-\\gamma+\\sum_{k=1}^\\infty \\left(\\frac{1}{k}-\\frac{1}{k+x-1}\\right) \\right)$$\n",
"\n",
"where $\\gamma=0.57721\\dots$ is the Euler-Mascheroni constant.\n",
"\n",
"### **(iv) Absolute or modulus |x|**\n",
"The absolute value or modulus $|x|$ is defined as positive $+x$ if $x$ is either positive or negative or zero if $x=0$ and can be differentiated by writing it as $\\sqrt{x^2}$ in which case\n",
"\n",
"$$\\displaystyle \\frac{d|x|}{dx}=\\frac{1}{2}(x^2)^{-1/2}2x=\\frac{x}{|x|}$$\n",
"\n",
"which is $\\pm 1$ depending on the sign of $x$. More complicated functions can be treated in the same way\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}|\\sin{x}|= \\frac{d}{dx}\\sqrt{\\sin^2{x}}=\\frac{\\sin(x)\\cos(x)}{|\\sin{x}|}$$\n",
"\n",
"which is $sign(\\sin(x))\\cos(x)$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3.14 Reciprocal derivatives\n",
"\n",
"Occasionally it is necessary, or simpler, to find $dx/dy$ rather than invert the equation to put it in terms of $y = \\cdots$ and calculate $dy/dx$. The derivatives are related as double reciprocals;\n",
"\n",
"$$\\displaystyle \\frac{dy}{dx}=1\\big/ \\frac{dx}{dy} \\qquad\\tag{13}$$\n",
"\n",
"As an example, suppose that $\\displaystyle \\sin(y^2) = x$, differentiating by $y$ gives the result $\\displaystyle dx/dy = 2y \\cos(y^2)$. Differentiating by $x$ could mean that a rearrangement must first be done to form $\\displaystyle y = \\sqrt{\\sin^{-1}(x)}$ and then this differentiated, which is quite involved. Instead using equation (6), the result is obtained directly $\\displaystyle 2y \\cos(y^2)dy/dx = 1$ and these two results show that equation (13) is true.\n",
"\n",
"## 3.15 Differentiating integrals\n",
"\n",
"If you are unfamiliar with integration, it will help to know the basic rules; see Chapter 4. In that chapter more examples are given particularly using both the Leibniz formula and Feynman's method of evaluating integrals. Only an outline of differentiating an integral is given here. \n",
"\n",
"Differentiating a definite integral with two limits both of which are constants, i.e. simply numbers $a$ and $b$, produces zero, because integration with such limits produces a number, e.g. the area under the curve from $a$ to $b$, see Fig. 1, and the differential of a constant is zero,\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_a^bf(x)dx=0 \\qquad\\tag{14}$$\n",
"\n",
"In the more complex and general case, where the limits $u$ and $v$ are themselves functions of $x$, the function of function rule is used (Section 5.1) as shown next.\n",
"\n",
"The fundamental theorem of the calculus states that\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_a^x f(t)dt=f(x)$$\n",
"\n",
"and to differentiate an integral with one limit that is a function of $x$, i.e. $v(x)$ and one a constant $a$ we start with\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_a^{v(x)} f(t)dt $$\n",
"\n",
"and let $y=v(x)$ thus\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_a^{v(x)} f(t)dt= \\frac{dy}{dx}\\frac{d}{dy}\\int_a^y f(t)dt =\\frac{dy}{dx}f(y)\\equiv\\frac{dv(x)}{dx}f(v(x))$$\n",
"\n",
"When both limits are functions\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_{v(x)}^{u(x)}f(t)dt=f(u)\\frac{du}{dx}-f(v)\\frac{dv}{dx} \\qquad\\tag{15} $$\n",
"\n",
"which is the simpler form of Leibniz's Integral Rule. An example where $x^2$ is one of the limits is,\n",
"\n",
"$$\\displaystyle \\frac{d}{dx}\\int_a^{x^2} e^{-at^2}dt=2xe^{-ax^4}-e^{-a^3}\\cdot 0 $$\n",
"\n",
"The aim in differentiating integrals is not to work out the integral first, which might not be possible anyway, and then differentiate the result, but to use equation (15), which avoids doing this.\n",
"\n",
"## 3.16 Fractional derivatives\n",
"\n",
"While it is possible to repeatedly take derivatives of many functions, for instance $\\displaystyle \\frac{d^3}{dx^3}\\sin(x)$, what about the $1/3$ or $1/2$ or $-1$ derivative? What would such a thing mean? In the case of $1/2$ derivatives we can say that if the function is $x^n$ then the half derivative is such that $\\displaystyle \\frac{d^{1/2}}{dx^{1/2}}\\frac{d^{1/2}}{dx^{1/2}}x^n\\equiv nx^{n-1}$. In other words differentiating, or operating twice on $x^n$ with $d^{1/2}/dx^{1/2}$, is the same as differentiating once with $dy/dx$. \n",
"\n",
"The general result for the $n^{th}$ derivative of $x^m$ is $\\displaystyle \\frac{d^ny}{dx^n}=\\frac{m!}{(m-n)!}x^{m-n}$ which can be generalised if $n$ is a fraction by changing the factorials to gamma functions as $n!=\\Gamma (n+1)$ thus $\\displaystyle \\frac{d^ny}{dx^n}=\\frac{\\Gamma (m+1)}{\\Gamma(m-n+1)}x^{m-n}$. As many functions can be expressed as power series it is possible to fractionally differentiate these. However, these unusual derivatives need not have more than a curiosity interest for us; they appear in Morse's paper on the anharmonic oscillator (P. Morse, Physical Review, 34, 57, 1929) and hardly anywhere else."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## 3.17 Table of Differentials\n",
"\n",
"$a,\\;b,\\;$ and $n$ are treated as constants.\n",
"\n",
"$$\\displaystyle \\begin{array}{lccc}\n",
"\\hline\n",
"\\displaystyle \\frac{d}{dx} x^n & = & nx^{n-1} \\\\\n",
"\\displaystyle\\frac{d}{dx}\\sin(ax+b) & = & a\\cos(ax+b)\\\\\n",
"\\displaystyle\\frac{d}{dx}\\cos(ax+b) & = & -a\\sin(ax+b)\\\\\n",
"\\displaystyle\\frac{d}{dx}\\tan(ax+b) & = &\\displaystyle a\\tan^2(ax+b)+a\\\\\n",
"\\displaystyle\\frac{d}{dx}\\ln(ax+b) & = & \\displaystyle\\frac{a}{ax+b}\\\\\n",
"\\displaystyle\\frac{d}{dx}e^{ax} & = & \\displaystyle ae^{ax}\\\\\n",
"\\displaystyle\\frac{d}{dx}a^{x} & = & \\displaystyle a^x\\ln(a)\\\\\n",
"\\displaystyle\\frac{d}{dx}\\sin^{-1}(ax+b) & = &\\displaystyle \\frac{a}{\\sqrt{1-(ax + b)^2 }}\\\\\n",
"\\displaystyle\\frac{d}{dx}\\cos^{-1}(ax+b) & = &\\displaystyle -\\frac{a}{\\sqrt{1-(ax + b)^2 }}\\\\\n",
"\\displaystyle\\frac{d}{dx}\\tan^{-1}(ax+b) & = &\\displaystyle \\frac{a}{1+(ax + b)^2 }\\\\\n",
"\\hline \\end{array}$$\n",
"\n",
"Using python/Sympy is very easy for more complex functions."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW0AAAAVCAYAAACNB786AAAAOXRFWHRTb2Z0d2F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07kX9zoHFBiCSph3j0CBD9/sVYSZvH6qyFnxLa42FpUX5Z49MKZFZtRL6DE0JkBADyJ9KT8NC3EXHTSbXmWVucY6G8HHkW0pcBuJN+avKDNHTi5pEjgMskPYsf6z/GbT8/xmMa3weGApjZh5Jm4QHif5U0E78S9wuMfgMsjLyj8kcB0/Drct/gqcXMHpQ0FzhW0kFm9kwBIRTDFGClpBfxq2Q74CDc2zwPmFlmu5XGZOBnwOHEHi40szwPw+NY6ymOmS2UNBx3TM2XNBU/xW2Gy/FToE+o+7yk3+HPnV+T9CAewtQPt8M+C1wea74p45NZmVUT8t/96IHfajYAFkh6GF+oB+I33zPN7InYNzmqN8/a1ByDJsmzgb6EDa8/8ELwFRIrS0Unbh6ZiZ+ONseVYlTo/DJAwK5mtjBW/3jcRrQ1bnPZHo8nHBfanRsY2gEPGazDd5CkDTT6jYLLKR/n4bGRPXFHycn4K7LRuP2qQZhSC2Eybnc7KU9Z1eUZblL9gWlmtiRZbmZ/wEM8p+Gmj1HAMfiV88ZE3dH446K3Q39GBD7H4ooX96o3ZXwyLbMqYlfcoTYX+An+KnUYMBj/DZJDzOy6GJ/VnmdtZo5B+fJsRF/2DnQfStRPTSfTP836XYT8Aco4oKc1jLutNu1fA9fhj2eebU7aTUFNZjWkQRb1Rf6CeAywnZk16tAuhtbwnyB813A1/pDgomIVKwlJ6+NKM7kVLj41mdWQBlnUlwHAy01dsKG2aDc7gs1sEDA37lxqBnQDbqXxV5uZRE1mNaRBFvXFzHY2s1wliNTMIzXUUEMNrQj/Bzx0/vNvHgOmAAAAAElFTkSuQmCC\n",
"text/latex": [
"$\\displaystyle 3 a x^{b} \\sin^{2}{\\left(a x \\right)} \\cos{\\left(a x \\right)} + \\frac{b x^{b} \\sin^{3}{\\left(a x \\right)}}{x}$"
],
"text/plain": [
" b 3 \n",
" b 2 b⋅x ⋅sin (a⋅x)\n",
"3⋅a⋅x ⋅sin (a⋅x)⋅cos(a⋅x) + ──────────────\n",
" x "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x,a,b = symbols('x,a,b')\n",
"\n",
"f01 = x**b*sin(a*x)**3\n",
"diff(f01,x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}