Code: Alles auswählen
>>> import numpy as np
>>> import scipy as sp
>>> import matplotlib as mpl
>>> import matplotlib.pyplot as plt
Code: Alles auswählen
np.array([pos_x, pos_y], dtype='float')
- nutze nump.linalg.norm statt deiner Hilfsfunktion
- a -= b ist schneller als a = a - b (weniger Typüberprüfungen notwendig)
- np.zeros((2), dtype='float') anstelle von np.array([0,0]) (ebenfalls schneller)
- geb dein Ergebnis direkt zurück ohne es an den Namen``out`` zu binden, z.B. ``return 0.5 * (time**2) * force + time * x[2] + x[1]``
- lese nicht alle Daten auf einmal ein, sondern verwende einen Generator, der dir immer die aktuelle Zeile zurückgibt. Das spart vor allem Memory, wenn du größere Datensätze hast.
So, muss jetzt zur Arbeit
Grüße
Gerrit