Home  >  Article  >  Backend Development  >  How to build a mathematical model using python

How to build a mathematical model using python

silencement
silencementOriginal
2019-05-22 15:03:328971browse

How to build a mathematical model using python

It is good to choose python for mathematical modeling. Python is open source. Open source things are full of vitality, and everyone is adding fuel to the fire. Programming experts all over the world are adding bricks and mortar to Python. Currently, the official (pypi.org) shows that there are more than 100,000 third-party libraries, and It seems that hundreds of new libraries are being added every day. Such a huge third-party library covers almost all walks of life and fields. If you want to do something, just look for it. There is usually a basic library suitable for you that others have already done. Okay, you can use it directly to get twice the result with half the effort

Here are some problems in mathematical modeling using python, using python3.x, scipy, numpy and matplotlib.

First add some basic data knowledge

1. numpy.array()

In basic operations, array and list are not distinguished (in indexing and deletion some There will be differences in operation and running time), and Python does not have the data structure array. Array is defined by numpy, a numerical calculation tool package. Because many operations must be performed on arrays (lists will cause errors), they need to be mastered. Refer to the official documentation below.

import numpy as np

How to build a mathematical model using python

How to build a mathematical model using python

How to build a mathematical model using python

##1. Linear programming

Select scipy.optimize.linprog to solve the problem of maximizing and minimizing linear programming problems. Learning materials: Official documentation.

We will not discuss specific issues here, but only involve the process of converting mathematical equations into functional language for solution. Reference book: Mathematical Modeling Algorithms and Applications.

How to build a mathematical model using python

2. Polynomial least squares curve fitting

Use numpy.polyfit.

How to build a mathematical model using python

The above is the detailed content of How to build a mathematical model using python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Why is python slow?Next article:Why is python slow?