0_1

映射

定义:XXYY 非空集合, 法则 ff , 对 XX 中每个元素 xx 。唯一的yy 与之对应, f:XYf: X \rightarrow Y

三要素:XX 原像、ff 映射、RfR_{f} 值域

xXx \in X对应的yy是唯一的 , RfYRfYR_{f} \subset Y R_{f} \neq Y

名称 满足条件
满射 Rf=YR_{f} = Y
单射 x1x2,f(x1)f(x2)x_{1} \neq x_{2}, f\left(x_{1}\right) \neq f\left(x_{2}\right)
一一映射 既是单射又是满射
逆映射 f:XYf: X \rightarrow Y 单射 , 每个 yRfy \in R_{f} 都有唯一的 xXx \in X
复合映射 f[g(x)]f[g(x)]

函数

函数的概念

定义:设数集$ D \subset \mathbf{R}$ , 则称映射$ f: D \rightarrow \mathbf{R}$ 为定义在$ D$ 上的函数记为$ \underline {y=f(x), x \in D}$

其中xx称为自变量,yy称为因变量, DD 称为定义域,记作DfD_{f} , 即Df=DD_{f}=D

常值函数

y=2,x(,+)y=2, x \in ( -\infty,+\infty)

定义域:(,+)(-\infty,+\infty) 值域:{2}\{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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=True)},
)

# x_min must be > 0 because log is undefined at 0.
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)
# jupyter notebook 的魔法函数运行方式
%manim -v WARNING -qh --format=gif -t LogScalingExample

output_4_0

绝对值函数

\begin{align} y & = |x| = \left\{\begin{array}{lc} -x, & x<0, \\ x, & x \geqslant 0 \end{array}\right. \end{align}

定义域:(,+)(-\infty,+\infty) 值域:Rf=[0,+)R_{f}=[0,+\infty)

#绝对值函数
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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=True)},
)

# x_min must be > 0 because log is undefined at 0.
graph = ax.plot(lambda x: abs(x), 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=|x|", x_val=2,direction=UP/1 , color=GREEN
)
self.add(ax, graph,sin_label)
# jupyter notebook 的魔法函数运行方式
%manim -v WARNING -qh --format=gif -t LogScalingExample

output_6_0

符号函数

\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=(,+)D=(-\infty,+\infty) 值域:Rf={1,0,1)R_{f}=\{-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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=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,
)#小于0
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,
)#等于1
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,
)#大于1
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)
# jupyter notebook 的魔法函数运行方式
%manim -v WARNING -qh --format=gif -t LogScalingExample

output_8_0

取整函数

\begin{align} y & = [x] \end{align}

定义:设xx为任一实数,不超过xx的最大整数称为xx的整数部分

比如:[1.03]=1;[0.36]=0;[1.3]=2;[3]=3;[57]=0[1.03]=1;[0.36]=0;[-1.3]=-2;[3]=3;[\frac{5}{7}]=0

定义域:(,+)(-\infty,+\infty) 值域:Rf=ZR_{f}=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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=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,
)#小于0
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,
)#小于0
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,
)#小于0
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,
)#小于0
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,
)#小于0
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)
# jupyter notebook 的魔法函数运行方式
%manim -v WARNING -qh --format=gif -t LogScalingExample

output_10_0

分段函数

\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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=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)
# jupyter notebook 的魔法函数运行方式
%manim -v WARNING -qh --format=gif -t LogScalingExample

output_12_0

函数的特性

有界性

定义

存在实数M>0M>0,使得对于集XX中的所有xx,都有f(x)M{\displaystyle |f(x)|\leq M}

如果对于集合XX中的所有xx,都有f(x)A{\displaystyle f(x)\leq A},则函数ff称为上有界的AA就是它的一个上界

如果对于集合XX中的所有xx,都有f(x)B{\displaystyle f(x)\geq B},则函数ff称为下有界的BB就是它的一个下界。

例子

\begin{align} f(x) & = \frac{1}{x^{2}-1} \end{align}

xx不等于−1或1是无界的(等于的话就没有意义)。如果把函数的定义域限制为[2,)[2,\infty),则函数就是有界的。

\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}, #是否将数字添加到刻度线。
#y_axis_config={"scaling": LogBase(custom_labels=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

2

红线不具有有界性,黄线具有有界性

单调性

定义

若函数xx值随着自变量的增大而增大,则函数是单调增加的

若函数xx值随着自变量的增大而减小,则函数是单调减少的

例子

\begin{align} y & = x^2 \end{align}

(,0)(-\infty,0)单调递减,在(0,)(0,\infty)单调递增

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

LogScalingExample@2022-12-13@13-35-21

\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

1

\begin{align} y & = x^{-1} = \frac{1}{x} \end{align}

(,0)(-\infty,0)单调递减,在(0,)(0,\infty)也是单调递减

奇偶性

定义

f(x)f(x)为一实变数实值函数,则f{\displaystyle f}偶函数若下列的方程对所有在f{\displaystyle f}的定义域内的x{\displaystyle x}都成立

\begin{align} f(x) & = f(-x) \end{align}

f(x){\displaystyle f(x)}为一个实变数实值函数,则f{\displaystyle f}奇函数若下列的方程对所有在ff的定义域内的x{\displaystyle x}都成立

\begin{align} f(x) & = -f(-x) \end{align}

\begin{align}f(-x) & = -f(x)\end{align}

总结:偶函数的图形关于yy轴对称,奇函数的图形关于原点对称

image-20221213140758006

例子

y=x2y=x^{2}y=cosxy=\cos x 都是偶函数

y=xy=xy=x3y=x^{3}y=sinxy=\sin xy=tanxy=\tan xy=arctanxy=\arctan x都是奇函数

y=exy=e^{x} 是非奇非偶的函数

周期性

定义

对于实数或者整数函数来说,周期性意味着按照一定的间隔重复一个特定部分就可以绘制出完整的函数图。如果在函数f{\displaystyle f}中所有的位置x{\displaystyle x}都满足

\begin{align} f(x+T) & = f(x) \end{align}

那么,f{\displaystyle f}就是周期为T{\displaystyle T}的周期函数。非周期函数就是没有类似周期T{\displaystyle T}的函数。

例子

常见的周期函数有sinx{\displaystyle \sin x}cosx{\displaystyle \cos x}tanx{\displaystyle \tan x}

img