Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! PYTHONPATH=/Users/markmikofski/Projects/pvlib-python:/Users/markmikofski/Projects/scipy/scipy/optimize ipython
- from numpy import sin as np_sin, exp as np_exp, asarray, random
- import zeros
- NUM_OF_IRRAD = 100000
- IL = random.rand(NUM_OF_IRRAD) + 6.0
- def f_solarcell(i, v, il, io, rs, rsh, vt):
- vd = v + i * rs
- return il - io * (np_exp(vd / vt) - 1.0) - vd / rsh - i
- def fprime(i, v, il, io, rs, rsh, vt):
- return -io * np_exp((v + i * rs) / vt) * rs / vt - rs / rsh - 1
- def fprime2(i, v, il, io, rs, rsh, vt):
- return -io * np_exp((v + i * rs) / vt) * (rs / vt)**2
- def bench_newton_array():
- """test newton with array"""
- return zeros.newton(f_solarcell, 7.0, fprime,
- (5.25, IL, 1e-09, 0.004, 10, 0.27456))
- def bench_halley_array():
- """test newton with array"""
- return zeros.newton(f_solarcell, 7.0, fprime,
- (5.25, IL, 1e-09, 0.004, 10, 0.27456),
- fprime2=fprime2)
- def bench_secant_array():
- """test newton with array"""
- return zeros.newton(f_solarcell, 7.0,
- args=(5.25, IL, 1e-09, 0.004, 10, 0.27456))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement