How to define the product of n functions

I want to define the product of n complex functions:
B(z)=\displaystyle\prod_{k=1}^n\frac{z-p_k}{1-\overline{p}_kz}, where p_k are n complex numbers of modulus <1.
I calculated a vector of partial products, and the function B is the last one in the respective vector.
Is there a simpler way to get the definition of this product?

function fproduct(f, g) 
    z -> f(z) * g(z)
end
BlaschkeF(z::Complex; p=0.5+0*im) = (z-p)/(1-conj(p)*z)
unitf(z::Complex) = 1.0+0*im    
n=5   
params = [0.95*cis(k*2pi/n)  for k in 0:n-1]    
prodf = Function[]
for p in params
    g = z->BlaschkeF(z;p=p)
    if !isempty(prodf)
        ppr = fproduct(last(prodf), g)  #ppr -partial product  
    else 
        ppr = fproduct(unitf, g)  
    end
    push!(prodf, ppr) 
end
B(z)=last(prodf)(z)

Is there a simpler way to get the definition of this product?

How about this?

BlaschkeF(z; p=0.5+0*im) = (z-p)/(1-conj(p)*z)
n=5   
params = [0.95*cis(k*2pi/n)  for k in 0:n-1]    
B(z) = prod(BlaschkeF(z, p=p) for p in params)
1 Like

I think params should be an input argument to B, instead of a global variable.

3 Likes