I want to evaluate a Blaschke product based on the set of zeroes, and compute its preimage for some points.
The Blaschke Product looks like:
$$B(z) = z^n\prod_{a_k\in \text{zeroes}} \frac{z - a_k}{1 - \bar{a_k}z} $$
where the set zeroes is a set of numbers where the Blaschke Product is designated to vanish.
The code I wrote looks like
BP [z_, zeroes_List] = Product[z^Boole[a == 0], {a, zeroes}] *
Product[((z - a)/(1 - a\[Conjugate]*z))^Boole[a != 0], {a, zeroes}]
but for some reason Mathematica evaluates this function as something completely different. So I don't know how to proceed.
I do have other code that works in evaluating some input, but Mathematica couldn't find the preimages of it, so this is also undesirable. It looks like this:
BP := {z, zeroes} |-> Product[z^Boole[a == 0], {a, zeroes}] *
Product[((z - a)/(1 - a\[Conjugate]*z))^Boole[a != 0], {a, zeroes}]
I'm completely new to the language, so any help would be appreciated!
=
, the right hand side is evaluated first, and then the left hand side is set to it. Be careful: named patterns on the left hand side, likez_
andzeroes_List
, aren't bound, as you can see from the syntax highlighting (they'll appear in blue or black). So if you have another definition for those symbols somewhere, it could mess up your intended code! considerx = 4; f[x_] = x + 1
. This will always evaluate to5
, no matter the input. $\endgroup$:=
, orSetDelayed
, which does not evaluate the right hand side until the function is called and the patterns are replaced. Unlike=
, it does bind its patterns, sox = 4; f[x_] := x + 1
will behave nicely, and e.g.f[9]
will give10
. (Sometimes you will want to force the right hand side to evaluate first; this is not one of those times. For that, you could useBlock[{x}, f[x_] = x + 1]
, effectively temporarily clearingx
for the duration of the definition, without fear.) $\endgroup$zeroes
has a value,Product
interprets{a, zeroes}
as{a, 1, zeroes}
, i.e. "the product with a going from1
tozeroes
". The second example works, becauseFunction
(|->
) always prevents evaluation of the right side until arguments are given. $\endgroup$BP := {z, zeroes} |-> ...
is highly nonstandard. Why? Because functions (defined with|->
,Function
, or&
) don't evaluate their bodies (right hand sides) anyway until called. But neither does:=
, so you're avoiding evaluation twice! So, you could useBP = {z, zeroes}, |-> ...
to the same effect. At that point, though, you may as well simply useBP[z_, zeroes_List] := ...
, as you get all the benefits of pattern-matching (like constrainingzeroes
to be a list) that|->
leaves you without. $\endgroup$