Ejemplo n.º 1
0
#!/usr/bin/python2
# -*- coding:utf-8 -*-

from __future__ import division
import numpy as np

# ---- this section is usefull everytime ----
import os, sys
sys.path.append('../libs')
from evaluation import Plotter
filename = os.path.splitext(os.path.basename(__file__))[0]
p = Plotter(show=True, save=True, pgf=False, name=filename, directory='')
# -------------------------------------------

# ==== DEFINITIONS ====

# ==== FUNCTIONS ====

# ==== CALCULATION ====

# ==== PLOTTING ====
p.new(title=u'Titlename')
p.plot(np.linspace(0, 10, 100),
       np.linspace(0, 10, 100)**2,
       '+-',
       label=u'Label % *.2f' % (6, 0.42))
p.make()
Ejemplo n.º 2
0
#!/usr/bin/python2
# -*- coding:utf-8 -*-

from __future__ import division
import numpy as np

# ---- this section is usefull everytime ----
import os, sys
sys.path.append('../libs')
from evaluation import Plotter
filename = os.path.splitext(os.path.basename(__file__))[0]
p = Plotter(show = True, save = True, pgf = False, name=filename, directory = '')
# -------------------------------------------

# ==== DEFINITIONS ====

# ==== FUNCTIONS ====
    
# ==== CALCULATION ====

# ==== PLOTTING ====
p.new(title=u'Titlename')
p.plot(np.linspace(0,10,100), np.linspace(0,10,100)**2, '+-', label=u'Label % *.2f' % (6,0.42))
p.make()
Ejemplo n.º 3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import division
import numpy as np

# ---- this section is usefull everytime ----
import os, sys

sys.path.append("../libs")
from evaluation import Plotter

filename = os.path.splitext(os.path.basename(__file__))[0]
p = Plotter(show=True, save=False, pgf=False, name=filename, directory="")
# -------------------------------------------

name, x_init, v_init, m, g = np.load("solar_system.npy")

# print name
# print x_init
# print v_init
# print m
# print g


def compute_forces(x, m):
    global g
    _l, c = x.shape
    F = np.zeros((c, c, 2))
    for i in range(c):
        for j in range(c):
Ejemplo n.º 4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from __future__ import division
import numpy as np

# ---- this section is usefull everytime ----
import os, sys
sys.path.append('../libs')
from evaluation import Plotter
filename = os.path.splitext(os.path.basename(__file__))[0]
p = Plotter(show=True, save=False, pgf=False, name=filename, directory='')
# -------------------------------------------

name, x_init, v_init, m, g = np.load('solar_system.npy')

#print name
#print x_init
#print v_init
#print m
#print g


def compute_forces(x, m):
    global g
    _l, c = x.shape
    F = np.zeros((c, c, 2))
    for i in range(c):
        for j in range(c):
            if j > i:
                F[i, j, :] = g * m[i] * m[j] * (
Ejemplo n.º 5
0
#!/usr/bin/python2
# -*- coding:utf-8 -*-

from __future__ import division
import numpy as np

# ---- this section is usefull everytime ----
import os, sys
sys.path.append('../libs')
from evaluation import Plotter
filename = os.path.splitext(os.path.basename(__file__))[0]
p = Plotter(show = True, save = True, pgf = False, name=filename, directory = '')
# -------------------------------------------


# ==== DEFINITIONS ====
m = 2.
g = 9.81
dt = 0.1

# ==== FUNCTIONS ====
def compute_forces(x,v,vw = np.array([0.,0.]), gamma = 0.):
    global m, g
    return np.array([0.,-m*g])-gamma*(v-vw)

def step_euler(x,v,f):
    global m, dt
    v = v + f/m *dt
    x = x + v*dt
    return x, v