Python linear equations solution example: python Linear Equations

Source: Internet
Author: User

Python linear equations solution example: python Linear Equations

This article describes how to solve Python linear equations. We will share this with you for your reference. The details are as follows:

Solving Linear Equations is relatively simple. You only need to use one function (Scipy. linalg. solve. For example, we need the solution of the following equation, which is a non-homogeneous linear equations:

3x_1 + x_2-2x_3 = 5

X_1-x_2 + 4x_3 =-2

2x_1 + 3x_3 = 2.5

The Code is as follows:

# Coding = utf-8import numpy as npfrom scipy. linalg import solvea = np. array ([[3, 1,-2], [1,-1, 4], [2, 0, 3]) B = np. array ([5,-2, 2.5]) x = solve (a, B) print ("helper house Test Result:") print (x)

Output result:

PS: Here are some recommended computing tools for your reference:

Calculation tool for online mona1 functions (equations:
Http://tools.jb51.net/jisuanqi/equ_jisuanqi

Scientific calculator online use _ advanced calculator online computing:
Http://tools.jb51.net/jisuanqi/jsqkexue

Online calculator _ standard calculator:
Http://tools.jb51.net/jisuanqi/jsq

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.