Ejemplo n.º 1
0
y = Y(1.5)
y(0.2)
print y


def diff(f, x, h=1.0E-10):
    return (f(x + h) - f(x)) / float(h)


y1 = Y(1)
print diff(y1.value, 0, 1)

from classes import VelocityProfile

v1 = VelocityProfile(R=1, beta=0.06, mu0=0.02, n=0.1)
from scitools.std import *
r = linspace(0, 1, 50)
v = v1.value(r)
plot(r, v, label=('r', 'v'), title='Velocity profile')

from classes import Account
a1 = Account('John Olsson', '19371554951', 20000)
a2 = Account('Liz Olsson', '19371564761', 20000)
a1.deposit(1000)
a1.withdraw(4000)
a2.withdraw(10500)
a1.withdraw(3500)
print "a1's balance:", a1.balance
a1.dump()
a2.dump()
Ejemplo n.º 2
0
from Complex import Complex
from Vec2D import Vec2D
from Polynomial import Polynomial as P

# run lumpy.object_diagram() from the main program, not a function,
# to avoid seeing the lumpy variable explicitly in the diagrams

lumpy = Lumpy() 
lumpy.make_reference()   # not necessary for class diagrams
y = Y(v0=4)
lumpy.object_diagram()
lumpy.class_diagram()
del y # remove it from the next diagrams

lumpy = Lumpy() 
v = VelocityProfile(beta=0.06, mu0=0.02, n=0.3, R=1)
lumpy.object_diagram()
lumpy.class_diagram()
del v

lumpy = Lumpy() 
v = Account('John Doe', '93351545761', 1000)
lumpy.object_diagram()
lumpy.class_diagram()
del v

lumpy = Lumpy() 
v = AccountP('John Doe', '93351545761', 1000)
lumpy.object_diagram()
lumpy.class_diagram()
del v