5
$\begingroup$

I want to define a function that outputs, say, an arbitrary number of complex coordinates on a Riemann sphere, $z_i$.

In Mathematica, I have been using Subscript[z,i] to label the individual coordinates, but there seems to be issues with the Subscript function - for example, Subscript[z,i]Subscript[k,j] - Subscript[z,i]Subscript[k,j] does not seem to always evaluate to zero as it should.

So my question is, what is the best way of labeling variables?

I don't want to use zi, because its not as nice to read. Is there any reason I couldn't use z[i], for example? Is there a standard way to do it?

Here is an example of a function I have defined:

PTFactor[m_] := Product[(Subscript[z, i]-Subscript[z, i+1]),{i,1,m-1}]*(Subscript[z, m]-Subscript[z, 1]);

Where m is any integer.

$\endgroup$
  • $\begingroup$ I think using z[i] instead of Subscript might be a good idea in the long term (not as nice to read, but much better to manipulate). But I wonder if you are really correct with your statement that the given example would "somtimes" not evaluate to zero. I think it should and would consider it a bug if it wouldn't. Can you give an example when this happens? $\endgroup$ – Albert Retey Aug 25 '16 at 20:23
5
$\begingroup$

Depending on what you want to do, z[i], which defines your sequence as a function with integer domain), can work fine. For example:

pt[m_] := Product[(z[i] - z[i + 1]), {i, 1, m - 1}]*(z[m] - z[1]);

For instance, pt[2] is

(z[1] - z[2]) (-z[1] + z[2])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.