
映射
定义:X、Y 非空集合, 法则 f , 对 X 中每个元素 x 。唯一的y 与之对应, f:X→Y
三要素:X 原像、f 映射、Rf 值域
x∈X对应的y是唯一的 , Rf⊂YRf=Y
名称 |
满足条件 |
满射 |
Rf=Y |
单射 |
x1=x2,f(x1)=f(x2) |
一一映射 |
既是单射又是满射 |
逆映射 |
设f:X→Y 单射 , 每个 y∈Rf 都有唯一的 x∈X |
复合映射 |
f[g(x)] |
函数
函数的概念
定义:设数集$ D \subset \mathbf{R}$ , 则称映射$ f: D \rightarrow \mathbf{R}$ 为定义在$ D$ 上的函数记为$ \underline {y=f(x), x \in D}$
其中x称为自变量,y称为因变量, D 称为定义域,记作Df , 即Df=D
常值函数
y=2,x∈(−∞,+∞)
定义域:(−∞,+∞) 值域:{2}
from manim import *
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-5, 5, 1], y_range=[-3, 3, 1], tips=False, axis_config={"include_numbers": True}, )
graph = ax.plot(lambda x: 2, x_range=[-2,2], use_smoothing=False,color=RED)
line_graph = ax.plot_line_graph( x_values = [0], y_values = [2], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=3, fill_color=PURPLE), stroke_width = 4, ) sin_label = ax.get_graph_label( graph, "y=2", x_val=2,direction=UP/1 , color=GREEN ) self.add(ax, graph,line_graph,sin_label)
%manim -v WARNING -qh --format=gif -t LogScalingExample
|

绝对值函数
\begin{align}
y & = |x| = \left\{\begin{array}{lc}
-x, & x<0, \\
x, & x \geqslant 0
\end{array}\right.
\end{align}
定义域:(−∞,+∞) 值域:Rf=[0,+∞)
from manim import *
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-3, 3, 1], y_range=[0, 3, 1], tips=False, axis_config={"include_numbers": True}, )
graph = ax.plot(lambda x: abs(x), x_range=[-2,2], use_smoothing=False,color=RED)
sin_label = ax.get_graph_label( graph, "y=|x|", x_val=2,direction=UP/1 , color=GREEN ) self.add(ax, graph,sin_label)
%manim -v WARNING -qh --format=gif -t LogScalingExample
|

符号函数
\begin{align}
y & = \operatorname{sgn} x = \left\{\begin{array}{ll}
-1, & x<0, \\
0, & x & = 0, \\
1, & x>0
\end{array}\right.
\end{align}
定义域:D=(−∞,+∞) 值域:Rf={−1,0,1)
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-2, 2, 1], y_range=[-2, 2, 1], tips=False, axis_config={"include_numbers": True}, )
graph1 = ax.plot(lambda x: -1, x_range=[-1,0], use_smoothing=False,color=RED) graph2 = ax.plot(lambda x: 0, x_range=[0,0], use_smoothing=False,color=RED) graph3 = ax.plot(lambda x: 1, x_range=[0,1], use_smoothing=False,color=RED) x_less_than_zero = ax.plot_line_graph( x_values = [0], y_values = [-1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=3, fill_color=PURPLE), stroke_width = 4, ) x_equal_zero = ax.plot_line_graph( x_values = [0], y_values = [0], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=3, fill_color=PURPLE), stroke_width = 4, ) x_more_than_the_zero = ax.plot_line_graph( x_values = [0], y_values = [1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=3, fill_color=PURPLE), stroke_width = 4, ) graph1_label = ax.get_graph_label( graph1, "y=-1", x_val=-1,direction=UR , color=GREEN ) graph2_label = ax.get_graph_label( graph2, "y=0", x_val=0,direction=UR , color=GREEN ) graph3_label = ax.get_graph_label( graph3, "y=1", x_val=1,direction=UR , color=GREEN ) self.add(ax, graph1,graph2,graph3,x_less_than_zero,x_equal_zero,x_more_than_the_zero,graph1_label,graph2_label,graph3_label)
%manim -v WARNING -qh --format=gif -t LogScalingExample
|

取整函数
\begin{align}
y & = [x]
\end{align}
定义:设x为任一实数,不超过x的最大整数称为x的整数部分
比如:[1.03]=1;[0.36]=0;[−1.3]=−2;[3]=3;[75]=0
定义域:(−∞,+∞) 值域:Rf=Z
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-4, 4, 1], y_range=[-3, 3, 1], tips=False, axis_config={"include_numbers": True}, )
graph1 = ax.plot(lambda x: -2, x_range=[-2,-1], use_smoothing=False,color=RED) graph2 = ax.plot(lambda x: -1, x_range=[-1,0], use_smoothing=False,color=RED) graph3 = ax.plot(lambda x: 0, x_range=[0,1], use_smoothing=False,color=RED) graph4 = ax.plot(lambda x: 1, x_range=[1,2], use_smoothing=False,color=RED) graph5 = ax.plot(lambda x: 2, x_range=[2,3], use_smoothing=False,color=RED)
x_graph1_1 = ax.plot_line_graph( x_values = [-2], y_values = [-2], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=0, fill_opacity=1, fill_color=PURPLE), stroke_width = 4, ) x_graph1_2 = ax.plot_line_graph( x_values = [-1], y_values = [-2], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=2, fill_opacity=1), stroke_width = 0, ) x_graph2_1 = ax.plot_line_graph( x_values = [-1], y_values = [-1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=0, fill_opacity=1, fill_color=PURPLE), stroke_width = 4, ) x_graph2_2 = ax.plot_line_graph( x_values = [0], y_values = [-1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=2, fill_opacity=1), stroke_width = 0, ) x_graph3_1 = ax.plot_line_graph( x_values = [0], y_values = [0], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=0, fill_opacity=1, fill_color=PURPLE), stroke_width = 4, ) x_graph3_2 = ax.plot_line_graph( x_values = [1], y_values = [0], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=2, fill_opacity=1), stroke_width = 0, ) x_graph4_1 = ax.plot_line_graph( x_values = [1], y_values = [1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=0, fill_opacity=1, fill_color=PURPLE), stroke_width = 4, ) x_graph4_2 = ax.plot_line_graph( x_values = [2], y_values = [1], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=2, fill_opacity=1), stroke_width = 0, ) x_graph5_1 = ax.plot_line_graph( x_values = [2], y_values = [2], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=0, fill_opacity=1, fill_color=PURPLE), stroke_width = 4, ) x_graph5_2 = ax.plot_line_graph( x_values = [3], y_values = [2], line_color=GOLD_E, vertex_dot_style=dict(stroke_width=2, fill_opacity=1), stroke_width = 0, ) self.add(ax, graph1,graph2,graph3,graph4,graph5,x_graph1_1,x_graph1_2,x_graph2_1,x_graph2_2,x_graph3_1,x_graph3_2,x_graph4_1,x_graph4_2,x_graph5_1,x_graph5_2)
%manim -v WARNING -qh --format=gif -t LogScalingExample
|

分段函数
\begin{align}
y & = f(x) = \left\{\begin{array}{ll}
2 \sqrt{x}, & 0 \leqslant x \leqslant 1 \\
1+x, & x>1
\end{array}\right.
\end{align}
定义:在自变量的不同变化范围中,对应法则用不同的式子来表达的函数
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-2, 2, 1], y_range=[-2, 2, 1], tips=False, axis_config={"include_numbers": True}, )
graph1 = ax.plot(lambda x: x**2+1, x_range=[0,1], use_smoothing=False,color=RED) graph2 = ax.plot(lambda x: 1+x, x_range=[-1,0], use_smoothing=False,color=YELLOW) graph3 = ax.plot(lambda x: -1, x_range=[-2,-1], use_smoothing=False,color=BLUE) graph1_label = ax.get_graph_label( graph1, "y=x^2+1", x_val=1,direction=UR , color=GREEN ) graph2_label = ax.get_graph_label( graph2, "y=1+x", x_val=-1,direction=6+LEFT*5, color=GREEN ) graph3_label = ax.get_graph_label( graph3, "y=-1", x_val=-2,direction=UR , color=GREEN ) self.add(ax, graph1,graph2,graph3,graph1_label,graph2_label,graph3_label)
%manim -v WARNING -qh --format=gif -t LogScalingExample
|

函数的特性
有界性
定义
存在实数M>0,使得对于集X中的所有x,都有∣f(x)∣≤M。
如果对于集合X中的所有x,都有f(x)≤A,则函数f称为上有界的,A就是它的一个上界
如果对于集合X中的所有x,都有f(x)≥B,则函数f称为下有界的,B就是它的一个下界。
例子
\begin{align}
f(x) & = \frac{1}{x^{2}-1}
\end{align}
x不等于−1或1是无界的(等于的话就没有意义)。如果把函数的定义域限制为[2,∞),则函数就是有界的。
\begin{align}
y & = \sin x
\end{align}在其定义域内有界
\begin{align}
y & = x^{2}
\end{align}在其定义域内无界
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-5, 5, 1], y_range=[-5, 5, 1], tips=False, axis_config={"include_numbers": True}, )
graph1 = ax.plot(lambda x: x**2, x_range=[-2,2], use_smoothing=False,color=RED) graph2 = ax.plot(lambda x: np.sin(x), x_range=[-1 * np.pi, 1 * np.pi], use_smoothing=False,color=YELLOW) graph1_label = ax.get_graph_label( graph1, "y=x^2", x_val=2,direction=UR , color=RED ) graph2_label = ax.get_graph_label( graph2, "y=\sin x", x_val=-2,direction=LEFT*6+5, color=YELLOW ) self.add(ax, graph1,graph2,graph1_label,graph2_label) %manim -v WARNING -qh --format=gif -t LogScalingExample
|

红线不具有有界性,黄线具有有界性
单调性
定义
若函数x值随着自变量的增大而增大,则函数是单调增加的
若函数x值随着自变量的增大而减小,则函数是单调减少的
例子
\begin{align}
y & = x^2
\end{align}
在(−∞,0)单调递减,在(0,∞)单调递增
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-3, 3, 1], y_range=[-5, 5, 1], tips=False, axis_config={"include_numbers": True}, #是否将数字添加到刻度线。 #y_axis_config={"scaling": LogBase(custom_labels=True)}, )
graph1 = ax.plot(lambda x: x**2, x_range=[-2,2], use_smoothing=False,color=RED) graph1_label = ax.get_graph_label( graph1, "y=x^2", x_val=2,direction=UR , color=RED )
self.add(ax, graph1,graph1_label) # jupyter notebook 的魔法函数运行方式 %manim -v WARNING -qh --format=gif -t LogScalingExample
|

\begin{align}
y & = x^3
\end{align}
在整个数轴上单调递增
from manim import * import numpy as np
class LogScalingExample(Scene): def construct(self): ax = Axes( x_range=[-3, 3, 1], y_range=[-6, 6, 1], tips=False, axis_config={"include_numbers": True}, #是否将数字添加到刻度线。 #y_axis_config={"scaling": LogBase(custom_labels=True)}, )
graph1 = ax.plot(lambda x: x**3, x_range=[-2,2], use_smoothing=False,color=RED) graph1_label = ax.get_graph_label( graph1, "y=x^3", x_val=2,direction=UR , color=RED )
self.add(ax, graph1,graph1_label) # jupyter notebook 的魔法函数运行方式 %manim -v WARNING -qh --format=gif -t LogScalingExample
|

\begin{align}
y & = x^{-1} = \frac{1}{x}
\end{align}
在(−∞,0)单调递减,在(0,∞)也是单调递减
奇偶性
定义
设f(x)为一实变数实值函数,则f为偶函数若下列的方程对所有在f的定义域内的x都成立
\begin{align}
f(x) & = f(-x)
\end{align}
设f(x)为一个实变数实值函数,则f为奇函数若下列的方程对所有在f的定义域内的x都成立
\begin{align} f(x) & = -f(-x) \end{align}
\begin{align}f(-x) & = -f(x)\end{align}
总结:偶函数的图形关于y轴对称,奇函数的图形关于原点对称

例子
y=x2、y=cosx 都是偶函数
y=x 、y=x3 、y=sinx 、y=tanx 、y=arctanx都是奇函数
y=ex 是非奇非偶的函数
周期性
定义
对于实数或者整数函数来说,周期性意味着按照一定的间隔重复一个特定部分就可以绘制出完整的函数图。如果在函数f中所有的位置x都满足
\begin{align}
f(x+T) & = f(x)
\end{align}
那么,f就是周期为T的周期函数。非周期函数就是没有类似周期T的函数。
例子
常见的周期函数有sinx,cosx和tanx等
