第一单元 用python学习微积分(五) 隐函数微分法和逆函数导数(下)- 反函数

本文内容来自学习麻省理工学院公开课:单变量微积分-隐函数微分法和逆函数导数-网易公开课

麻省理工学院公开课:单变量微积分习题课-除法法则-网易公开课

开发环境准备:CSDN

目录

一、反函数

1、定义

2、例子:

二、只要有原函数的导数, 用隐函数微分法可以求导任意反函数,

1、例子:

(1) ​

(2) ​


一、反函数

1、定义

y = x^{1/2}, x>0, y^2 = x

f(x) = x^{1/2}, g(y) = x, g(y) = y^2

通常 y = f(x) , g(y) = x

g(f(x)) = x, g=f^{-1}, f= g^{-1} 这些就是反函数了

2、例子:

y = x^{1/2}    g(y) = x , 怎么知道 g(x)?

方法是,交换x和y的值。 画出的图,两个不同的函数将通过x=y对称, 分别是 y = x^{1/2}, y = x^2

from sympy import *
import numpy as np 
import matplotlib.pyplot as plt 

x= symbols('x')
y = x**0.5
yarr = []
xarr = np.linspace(0 , 3 , 100 ) 
for xval in xarr:
    yval = y.subs(x,xval)
    yarr.append(yval)

y_nparr = np.array(yarr) 

plt.plot(xarr, y_nparr, color='b', label='y = x^0.5')
plt.plot(y_nparr,xarr , color='r', label='inverse function of "y = x^0.5"')


plt.plot(xarr, xarr, color='b', label='symmetric line')
plt.legend(loc='upper right')
plt.show() 

二、只要有原函数的导数, 用隐函数微分法可以求导任意反函数,

1、例子:

(1) y = tan^{-1}x ------ [arctan(x).... tan(y) = x]

y = tan(x) (-pi/2 < x< pi/2 )

注意看绿色的曲线:(\lim_{x \rightarrow \infty}{x}tan^{-1}x = \frac{\pi}{2} )

求导:\frac{d}{dy}tan(y) = \frac{d}{dy}\frac{sin(y)}{cos(y)}= \frac{sin'(y)cos(y)-cos'(y)sin(y)}{(cos(y))^2}=\frac{(cos(y))^2 +(sin(y))^2}{(cos(y))^2}=\frac{1}{(cos(y))^2}

(注:用到三角函数公式 sin^2x +cos^2x = 1 )

x = symbols('x')
z1 = sin(x)/cos(x)
derivative_f = z1.diff(x)

继续推导:

\frac{d}{dx}(tan(y) = x)

(\frac{1}{cos^2(y)})y' = 1, y' = cos^2y..............   \frac{d}{dx}tan^{-1}x = cos^2(tan^{-1}x)(太复杂了...)

简化: 由于y = tan^{-1}(x) -> x = tan(y)

import numpy as np 
from sympy import *
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.set_aspect( 1 ) 
angle = np.linspace( 0 , 2 * np.pi , 150 ) 
y = 60/180 * np.pi

angleArc = np.linspace( 0 , y , 150 ) 
radius = (tan(y))**2 + 1
xArc = radius * np.cos( angleArc ) /20
yArc = radius * np.sin( angleArc ) /20

ax.plot( xArc, yArc,color='r') 
plt.text(tan(y)/10, tan(y)/10, 'y', fontsize=12)
ax.plot( [0,1,1,0], [0,tan(y),0,0],color='b',label='x=tany, y='+format(y)) 
plt.text(1.1, tan(y)/2, 'x', fontsize=12)
plt.text(0.3, tan(y)/13, 'bottom line length = 1', fontsize=12)

plt.text(-0.34, 0, 'A', fontsize=12)
plt.text(1.2, 0, 'B', fontsize=12)
plt.text(1.1,tan(y)+0.1 , 'C', fontsize=12)

plt.text(0.3, tan(y)/13, 'bottom line length = 1', fontsize=12)
plt.text(0.3, tan(y)/13+0.1, 'tany = x/1 (BC : AC)', fontsize=12)
plt.text(0.3, tan(y)/13+0.2, 'cosy = 1/(1-x^2)^{1/2}', fontsize=12)
plt.legend(loc='upper right')
plt.show() 

由图可知:

cos(y) = \frac{1} {(1+x^2)^{1/2}}

\frac{d}{dy}tan(y) =\frac{1}{(cos(y))^2} = (1+x^2)^{1/2}

(2) y = sin^{-1}x

       x = sin(y)

       \frac{d}{dx}(x=sin(y))

       1 = cos(y)y', y' = \frac{1}{cos(y)} = \frac{1}{(1-sin^2y)^{1/2}}

由于 x= sin(y)

\frac{1}{(1-sin^2y)^{1/2}} = \frac{1}{(1-x^2)^{1/2}}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bullseye

您的鼓励是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值