强基初中数学&学Python——第六十七课 函数与方程之十一:一元一次绝对值函数


  一元一次函数表达式中含有含自变量的绝对值,它们的图象与普通的一元一次函数有何不同呢?

(1)y=x 与 y=|x|  

 

 

 

(2)y=x+1 、 y=|x+1| 与 y=|x|+1

 

 

 

3y=x-1 、 y=|x-1| 与 y=|x|-1

 

 

 

(4)y=-x 与 y=-|x|

 

 

5y=-x+1 、 y=-|x+1| 与 y=-|x|+1

 

 

 

6y=-x-1 、 y=-|x-1| 与 y=-|x|-1

 

 

 

  我们把一元一次绝对值函数普通式写为

y=a|x+b|+c (a≠0),

由上面这些函数图可以看出一元一次绝对值函数的性质:

(1)a>0,折角向上开,顶点(折点)是函数的最小值;a<0,折角向下开,顶点是函数的最大值。

(2)b>0,函数图象在x轴方向向左平移b个单位;b<0,函数图象在x轴方向向右平移-b个单位。由负数的意义,可以说,函数图象在x轴方向向左平移b个单位。

(3)c>0,函数图象在y轴方向向上平移c个单位;c<0,函数图象在y轴方向向下平移c个单位。由负数的意义,可以说,函数图象在y轴方向向上平移c个单位。

  例题1判断下面的一元一次绝对值函数有最大值还是最小值,并计算当x取什么值时,函数取得极值(最大或最小值)的大小,作图验证。

(1)y=2|x+3|-1,  (2)y=-3|x-2|+1

解:(1)有最小值,当x=-3时,|x+3|=0,这时函数的值最小,等于-1。作图验证如下图。

 

2)有最大值,当x=2时,|x-2|=0,这时函数的值最大,等于1。作图验证如下图。

 

  由上面例题的函数图,可知,a的绝对值越大,函数图的角就越尖。

  练习题1判断下面的一元一次绝对值函数有最大值还是最小值,并计算当x取什么值时,函数取得极值(最大或最小值)的大小,作图验证。

(1)y=3|-x+1|-2,  (2)y=-2|-x-3|+1

 

附录1

import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=x",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录1",align="center", font=("宋体",14,"normal"))
def f(x):  
    return x
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录2
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=|x|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录2",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x<0:
        return -x
    else:
        return x
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录3

import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=x+1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录3",align="center", font=("宋体",14,"normal"))
def f(x):  
    return x+1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录4
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=|x+1|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录4",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x+1
    if t<0:
        return -t
    else:
        return t
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录5
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=|x|+1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录5",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x<0:
        return -x+1
    else:
        return x+1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录6
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=x-1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录6",align="center", font=("宋体",14,"normal"))
def f(x):  
        return x-1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录7
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=|x-1|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录7",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x-1
    if t<0:
        return -t
    else:
        return t
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录8
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=|x|-1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录8",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x<0:
        return -x-1
    else:
        return x-1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录9
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-x",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录9",align="center", font=("宋体",14,"normal"))
def f(x):  
        return -x
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录10

import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-|x|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录10",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x>0:
        return -x
    else:
        return x
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录11
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-x+1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录11",align="center", font=("宋体",14,"normal"))
def f(x):  
        return -x+1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录12
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-|x+1|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录12",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x+1
    if t>0:
        return -t
    else:
        return t
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录13
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-|x|+1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录13",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x>0:
        return -x+1
    else:
        return x+1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录14
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-x-1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录14",align="center", font=("宋体",14,"normal"))
def f(x):  
        return -x-1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录15
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-|x-1|",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录15",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x-1
    if t>0:
        return -t
    else:
        return t
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录16
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-|x|-1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录16",align="center", font=("宋体",14,"normal"))
def f(x):  
    if x>0:
        return -x-1
    else:
        return x-1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

 

附录17

import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=2|x+3|-1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录17",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x + 3
    if t<0:
        return -t*2-1
    else:
        return t-1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()

附录18
import sys
sys.path.append("/5xstar/pyfiles")
from mymath.rcs import *
import turtle as t
t.setup(400,400)
t.screensize(200,200)  
t.up()
build(t)
t.setpos(0, -130)
t.write("y=-3|x-2|+1",align="center", font=("Arial",20,"normal"))
t.setpos(0, -160)
t.write("作图代码附录18",align="center", font=("宋体",14,"normal"))
def f(x):  
    t = x - 2
    if t>0:
        return -t*3+1
    else:
        return t*3+1
t.pencolor("blue")
trace(t,-10, 10, f)      
t.ht()