线性代数 向量 物理向量_线性函数向量 使用Python的线性代数
线性代数 向量 物理向量
Prerequisite:
先决条件:
Defining a Vector using list
使用列表定义向量
Defining Vector using Numpy
使用Numpy定义向量
A Linear Vector is a type of vector which has elements following a linear function. For example, a vector [2,4,6,8,10,12,14,16] and [5,8,11,14,17,20,23,26]. We can represent them mathematically as,
线性向量是一种向量,其向量具有遵循线性函数的元素。 例如,向量[2,4,6,8,10,12,14,16]和[5,8,11,14,17,20,23,26] 。 我们可以用数学方式将它们表示为
y = 2x, for the first example
y = 3x + 5, for the second example
In general,
y = ax + b
Where,
a is a linear multiplicative factor, and
b is an offset value.
We have an inbuilt function within numpy library which lets us create this mathematical linear function and its data points very easily.
我们在numpy库中有一个内置函数,可让我们非常轻松地创建此数学线性函数及其数据点。
Syntax:
句法:
numpy.arange(low, up, mul_a)
low - lower limit as value b (offset)
up - upper limit
mul_a - multiplicative factor i.e. a
Such types of vectors have applications in Plotting (Data Visualization) and Machine Learning.
这种类型的向量在绘图( 数据可视化 )和机器学习中具有应用。
Application:
应用:
Machine Learning
机器学习
Plotting and Data Visualization
绘图和数据可视化
Constraint Based Programming
基于约束的编程
线性函数向量的Python程序 (Python program for linear function vector)
# Linear Algebra Learning Sequence
# Linear Function Vector
import numpy as np
# Example 1, length 20
t1 = np.arange(0,30,2)
print('Example : ', t1)
# Example 2, length 20
t2 = np.arange(0,100,14)
print('\n\nExample : ', t2)
# Example 3, length 20
t3 = np.arange(24,56)
print('\n\nExample : ', t3)
# Example 4, length 30
t4 = np.arange(50)
print('\n\nExample : ', t4)
Output:
输出:
Example : [ 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28]
Example : [ 0 14 28 42 56 70 84 98]
Example : [24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55]
Example : [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49]
翻译自: https://www.includehelp.com/python/a-linear-function-vector.aspx
线性代数 向量 物理向量
还没有评论,来说两句吧...