Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to change this define function?

Crubal Chenxi LiCrubal Chenxi Li Member Posts: 1

The following Error Message shows up in the last 'Plot' procedure: In Z(Q), 'numpy.float64' object is not iterable.

I would like Z(Q) returns value that sum each i in the range (0, len(p)), which is a function with variable Q. And finally the plot is Q(X Axis) and Z(Q)(Y Axis) for each Q it can be plotted.

How can I modify Z(Q)? Thank you!

Code:

import numpy as np
import scipy.stats as stats
from scipy.stats import poisson, norm

cs = 100
co = 300
mu = 4.7

G = poisson(mu)
p = G.pmf(np.arange(3*mu))

Define Z(Q) function

def Z(Q):
for i in range(len(p)):
return sum(p[i]csmax((Q-i), 0) + p[i]comax((i-Q), 0))

Plot Q and (Q)

import pylab as pl

x = []
y = []

for Q in range(0, 12):
x.append(Q)
y.append(Z(Q))

pl.plot(x, y, '-o')
pl.show()

Comments

  • Himanshu MishraHimanshu Mishra Member Posts: 11

    Hey guys if you are really the online card game addictive then here on our homepage you will play free euchre online game on your pc tablet and on your smartphone it is really an awesome and fantastic game playing by people all over the world it is really an awesome card game the goal of the game is to take more hands than your opponent.

Sign In or Register to comment.