Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 26, 2019 17:35
Show Gist options
  • Save ikatsov/559dda69b7a8f86c5e0d6fb394eeb702 to your computer and use it in GitHub Desktop.
Save ikatsov/559dda69b7a8f86c5e0d6fb394eeb702 to your computer and use it in GitHub Desktop.
def linear(a, b, x):
return b + a*x
# a linear demand function is generated for every
# pair of coefficients in vectors a_vec and b_vec
def demand_hypotheses(a_vec, b_vec):
for a, b in itertools.product(a_vec, b_vec):
yield {
'd': functools.partial(linear, a, b),
'p_opt': -b/(2*a)
}
@yosephyo
Copy link

def linear(a, b, x):
return b + a*x

a linear demand function is generated for every

pair of coefficients in vectors a_vec and b_vec

def demand_hypotheses(a_vec, b_vec):
for a, b in itertools.product(a_vec, b_vec):
yield {
'd': functools.partial(linear, a, b),
'p_opt': -b/(2*a)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment