线性代数 向量 物理向量_线性函数向量 使用Python的线性代数

我不是女神ヾ 2023-03-05 15:54 130阅读 0赞

线性代数 向量 物理向量

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] 。 我们可以用数学方式将它们表示为

  1. y = 2x, for the first example
  2. y = 3x + 5, for the second example
  3. In general,
  4. y = ax + b
  5. Where,
  6. a is a linear multiplicative factor, and
  7. 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:

句法:

  1. numpy.arange(low, up, mul_a)
  2. low - lower limit as value b (offset)
  3. up - upper limit
  4. mul_a - multiplicative factor i.e. a

Such types of vectors have applications in Plotting (Data Visualization) and Machine Learning.

这种类型的向量在绘图( 数据可视化 )和机器学习中具有应用。

Application:

应用:

  1. Machine Learning

    机器学习

  2. Plotting and Data Visualization

    绘图和数据可视化

  3. Constraint Based Programming

    基于约束的编程

线性函数向量的Python程序 (Python program for linear function vector)

  1. # Linear Algebra Learning Sequence
  2. # Linear Function Vector
  3. import numpy as np
  4. # Example 1, length 20
  5. t1 = np.arange(0,30,2)
  6. print('Example : ', t1)
  7. # Example 2, length 20
  8. t2 = np.arange(0,100,14)
  9. print('\n\nExample : ', t2)
  10. # Example 3, length 20
  11. t3 = np.arange(24,56)
  12. print('\n\nExample : ', t3)
  13. # Example 4, length 30
  14. t4 = np.arange(50)
  15. print('\n\nExample : ', t4)

Output:

输出:

  1. Example : [ 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28]
  2. Example : [ 0 14 28 42 56 70 84 98]
  3. Example : [24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  4. 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55]
  5. Example : [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  6. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
  7. 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

线性代数 向量 物理向量

发表评论

表情:
评论列表 (有 0 条评论,130人围观)

还没有评论,来说两句吧...

相关阅读