线性方程组 python_线性方程组的表示 使用Python的线性代数

本文介绍了如何使用Python的线性代数来表示和处理线性方程组,包括定义向量和矩阵。内容涵盖线性方程在机器学习、微积分、线性规划和物理动力学等领域的应用。
摘要由CSDN通过智能技术生成

线性方程组 python

Prerequisites:

先决条件:

In this article, we are going to learn how to represent a linear equation in Python using Linear Algebra. For example we are considering an equation with 3 variables (x,y,z and t).

在本文中,我们将学习如何使用线性代数在Python中表示线性方程。 例如,我们正在考虑具有3个变量( x,y,z t )的方程

    3x + 4y - 7z + 12t = 46
    2x + 7y - 13z + 3t = 65
    34x + 4y - 4z + 34t = 78

The above equation has a form as below in linear Algebra:

上式的线性代数形式如下:

    Ax = b, x = (x y z t)

Application:

应用:

  1. Machine Learning

    机器学习

  2. Calculus

    结石

  3. Linear Programming

    线性规划

  4. Physics and Kinetic Studies

    物理与动力学研究

用于表示线性方程组的Python代码 (Python code for Representation of a system of linear equation)

# Linear Algebra Learning Sequence
# Representation of a System of Linear Equation

import numpy as np

# Use of np.array() to define an Vector
A = np.array([[3, 4, -7, 12], [2, 7, -13, 3], [34, 4, -4, 34]])
b = np.array([46, 65, 78])
print("The Matrix A : \n",A)

x = np.array(['x', 'y', 'z', 't'])
print("\nThe Vector x : ",x)
print("\nThe Vector b : ",b)


print("\n---Now the equations is represented in form of vector: Ax = b---")
print("This is just a python intrepetation of understanding a linear equation")

Output:

输出:

The Matrix A : 
 [[  3   4  -7  12]
 [  2   7 -13   3]
 [ 34   4  -4  34]]

The Vector x :  ['x' 'y' 'z' 't']

The Vector b :  [46 65 78]

---Now the equations is represented in form of vector: Ax = b---
This is just a python intrepetation of understanding a linear equation


翻译自: https://www.includehelp.com/python/representation-of-a-system-of-linear-equation.aspx

线性方程组 python

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值