def main(): y0, t0, dt0, tmax = numpy.asarray([1, 2, -1]), 0.0, 0.05, 2.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print (" t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (' ', dt0)) print ('-' * 77) for i in range(0, len(tn)): print (" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) print('')
def main(): y0, t0, dt0, tmax = numpy.asarray([1, 2, -1]), 0.0, 0.05, 2.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print( " t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (' ', dt0)) print('-' * 77) for i in range(0, len(tn)): print(" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) print('')
def main(): y0, t0, tmax = 0.5, 0.0, 2.0 for dt in [0.5, 0.2, 0.05]: (yn, tn, en) = rk4pasvar(yp, y0, t0, dt, tmax) print (" t | Soluția numerică | Soluția analitică | Eroare (Δt = %g)" % dt) print ('-' * 66) for i in range(0, len(tn)): wn = y(tn[i]) print (" %2.2f | %5.15f | %5.15f | %5.15f" % (tn[i], wn, yn[i], abs(yn[i] - wn))) print('')
def main(): y0, t0, tmax = 0.5, 0.0, 2.0 for dt in [0.5, 0.2, 0.05]: (yn, tn, en) = rk4pasvar(yp, y0, t0, dt, tmax) print( " t | Soluția numerică | Soluția analitică | Eroare (Δt = %g)" % dt) print('-' * 66) for i in range(0, len(tn)): wn = y(tn[i]) print(" %2.2f | %5.15f | %5.15f | %5.15f" % (tn[i], wn, yn[i], abs(yn[i] - wn))) print('')
def main(): # creează figură fig = pyplot.figure() ax = fig.add_subplot(111, projection='3d') # setează etichetele și titlul ax.set_xlabel('Axa X') ax.set_ylabel('Axa Y') ax.set_zlabel('Axa Z') ax.set_title('Atractorul Lorenz 3D') y0, t0, dt0, tmax = numpy.asarray([-7.5, -3.6, 30.]), 0.0, 0.05, 26.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print (" t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (' ', dt0)) print ('-' * 77) for i in range(0, len(tn)): print (" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) ax.scatter(*yn[i], s = 0.2) # afișare punct 3D print('') pyplot.show()
def main(): # creează figură fig = pyplot.figure() ax = fig.add_subplot(111, projection='3d') # setează etichetele și titlul ax.set_xlabel('Axa X') ax.set_ylabel('Axa Y') ax.set_zlabel('Axa Z') ax.set_title('Atractorul Lorenz 3D') y0, t0, dt0, tmax = numpy.asarray([-7.5, -3.6, 30.]), 0.0, 0.05, 26.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print( " t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (' ', dt0)) print('-' * 77) for i in range(0, len(tn)): print(" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) ax.scatter(*yn[i], s=0.2) # afișare punct 3D print('') pyplot.show()
def main(): # creează figură fig = pyplot.figure() ax = fig.add_subplot(111, projection="3d") # setează etichetele și titlul ax.set_xlabel("Axa X") ax.set_ylabel("Axa Y") ax.set_zlabel("Axa Z") ax.set_title("Atractorul Lorenz 3D") y0, t0, dt0, tmax = numpy.asarray([-7.5, -3.6, 30.0]), 0.0, 0.05, 26.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print(" t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (" ", dt0)) print("-" * 77) x, y, z = [], [], [] for i in range(0, len(tn)): print(" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) [xi, yi, zi] = yn[i].tolist() x.append(xi), y.append(yi), z.append(zi) print("") ax.plot(x, y, z) pyplot.show()
def main(): # creează figură fig = pyplot.figure() ax = fig.add_subplot(111, projection='3d') # setează etichetele și titlul ax.set_xlabel('Axa X') ax.set_ylabel('Axa Y') ax.set_zlabel('Axa Z') ax.set_title('Atractorul Lorenz 3D') y0, t0, dt0, tmax = numpy.asarray([-7.5, -3.6, 30.]), 0.0, 0.05, 26.0 (yn, tn, en) = rk4pasvar(yp, y0, t0, dt0, tmax) print (" t | Soluția numerică a punctelor [x y z] %6s | Eroare (Δt = %g)" % (' ', dt0)) print ('-' * 77) x, y, z = [], [], [] for i in range(0, len(tn)): print (" %2.6f | %-42s | %5.15f" % (tn[i], yn[i], en[i])) [xi, yi, zi] = yn[i].tolist() x.append(xi), y.append(yi), z.append(zi) print('') ax.plot(x, y, z) pyplot.show()