Skip to content

Commit 0dcb41e

Browse files
Fix max profit repr with more than one random symbol
1 parent 87695cb commit 0dcb41e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

empulse/metrics/metric.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,14 @@ def _repr_latex_(self) -> str:
684684
random_symbols = [symbol for symbol in profit_function.free_symbols if is_random(symbol)]
685685

686686
if random_symbols:
687-
random_symbol = random_symbols[0]
688-
h = sympy.Function('h')(random_symbol)
689-
integrand = profit_function * h
690-
lower_bound, upper_bound = pspace(random_symbol).domain.set.args[:2]
691-
integral = sympy.Integral(integrand, (random_symbol, lower_bound, upper_bound))
687+
integrand = profit_function
688+
for random_symbol in random_symbols:
689+
integrand *= density(random_symbol).pdf(random_symbol)
690+
integral = integrand
691+
for random_symbol in random_symbols:
692+
lower_bound, upper_bound = pspace(random_symbol).domain.set.args[:2]
693+
integral = sympy.Integral(integral, (random_symbol, lower_bound, upper_bound))
694+
692695
s = latex(integral, mode='plain', order=None)
693696
else:
694697
s = latex(profit_function, mode='plain', order=None)

0 commit comments

Comments
 (0)