← 返回题库
初级

探索向量线性组合的终点范围

未完成
初级参考 完整示例代码供参考,建议自己理解后重新输入
from random import uniform
# uniform函数在[a, b)或[a, b]范围内获取一个随机数。

u = (-1, 1)
v = (1, 1)

def random_r():
    return uniform(-3, 3)

def random_s():
    return uniform(-1, 1)


possibilities = [add(scale(random_r(), u), scale(random_s(), v))
                 for i in range(0, 500)]
draw(
    Points(*possibilities)
)
    plt.show()
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码