Untitled

mail@pastecode.io avatar
unknown
plain_text
10 months ago
570 B
2
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np

# Define the range of fees from 0 to 30
fees = np.linspace(0, 30, 100)

# Calculate expected utility for each fee
prob_heads = 0.6
EU = prob_heads * (80 - fees)**2 + (1 - prob_heads) * (30 - fees)**2

# Plotting the graph
plt.figure(figsize=(8, 6))
plt.plot(fees, EU, label='Expected Utility')
plt.xlabel('Fee (F)')
plt.ylabel('Expected Utility')
plt.title('Expected Utility vs. Fee for the Gamble')
plt.axhline(y=2500, color='r', linestyle='--', label='Utility without Gamble')
plt.legend()
plt.grid(True)
plt.show()
Leave a Comment