S
S
skomoroh2013-05-07 19:47:42
Python
skomoroh, 2013-05-07 19:47:42

How to get (interpolation) a formula (by text) from a matrix of values ​​​​in python?

There is a function of 3 parameters f (a, b, c) in a black box, there is a matrix of results-values, you need to get a text formula to apply in the future.

scipy seems to know how to interpolate, but I didn’t find how to pull out the formula =(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GDApsy, 2013-05-10
@GDApsy

So if I understand interpolation correctly, as Eddy_Em said, everything depends very much on the method, since it already gives a “text” formula, in other words, the formula of the function approximating the desired one, such formulas themselves are in reference books, and in interpolation programs and subroutines in human-readable format, no one will push them in normal cases

V
Vitaly, 2014-10-23
@volovikovv

A solution to your question in the one-dimensional case:
>>>import sympy
>>>x = sympy.symbols('x')
>>>sympy.interpolate([(-1, 2), (1, 2), (2, 5)], x)
x**2 + 1
But in the case of several variables, I don't know how to solve a similar problem head-on.
There are functions linfit, polyfit in matkad, but this already applies to approximation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question