Skip to content

Instantly share code, notes, and snippets.

@csbuja
csbuja / rod.py
Last active February 15, 2019 18:53
rod
import numpy as np
def cutrod(p,n):
if n == 0:
return 0
q = -1*np.inf
for i in range(n):
i_ = i+1
q = np.max([q, p[i_-1] + cutrod( p,n - i_) ])
return q
@csbuja
csbuja / argh_examples.py
Created March 30, 2021 18:32 — forked from safijari/argh_examples.py
Python Libraries Video 1
import argh
def do_the_thing(required_arg, optional_arg=1, other_optional_arg=False):
"""
I am a docstring
"""
print((required_arg, type(required_arg)))
print((optional_arg, type(optional_arg)))
print((other_optional_arg, type(other_optional_arg)))
import numpy as np
from scipy.integrate import odeint
import math
import matplotlib.pyplot as plt
def xvyplot(t,sol,e):
plt.plot(sol[:, 0],sol[:, 1] , 'p', label='x(t) vs y(t)')
plt.title("x v y with eccentricity of " + str(e))
plt.legend(loc='best')
plt.xlabel('x')