Answer the question
In order to leave comments, you need to log in
How to make an interface to this program in Qt? So that he asked to enter 4 x and 4 games? And then he displayed the already finished number after the calculation?
import numpy as np
import matplotlib.pyplot as plt
x = np.array([-6, 7, 4, 3], dtype=float)
y = np.array([-297, 249, 33, 9], dtype= float)
def lagranz(x, y, t):
z = 0
for j in range(len(y)):
p1 = 1;
p2 = 1
for i in range(len(x)):
if i == j:
p1 = p1 * 1;
p2 = p2 * 1
else:
p1 = p1 * (t - x[i])
p2 = p2 * (x[j] - x[i])
z = z + y[j] * p1 / p2
return z
xnew = np.linspace(np.min(x), np.max(x), 100)
ynew = [lagranz(x, y, i) for i in xnew]
plt.plot(x, y, 'o', xnew, ynew)
plt.grid(True)
plt.show()
Answer the question
In order to leave comments, you need to log in
Open any PyQt5 lesson. Or there is a good book Python 3 and PyQt 5. Application Development.
It says how to create a simple GUI form for entering numbers with a button.
Here is an example set of lessons: tyts .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question