# Using "Z with subscript" parameters in solve solutions

Trying to solve some equation and faced with z with subscript notation. Tried to google it but failed.

sage: t = SR.var('t')
sage: eq = cos(t) + 6 - 5 - 1.5 * sin(t) == 0
sage: sol = solve([eq], t, to_poly_solve=True)
sage: sol
[t == pi + 2*pi*z1798, t == 2*pi*z1816 + arctan(12/5)]


Guess z1798 and z1816 mean "any integer". But what do numbers after z mean?

Can I set an integer manually and calculate the corresponding solution?

edit retag close merge delete

( 2022-02-16 14:01:46 +0200 )edit

Congratulations for guessing the meaning of the $z_n$ in the solutions returned by solve!

( 2022-02-16 14:23:15 +0200 )edit

Searching Ask Sage for "solve" + "z" reveals similar questions answered in the past.

( 2022-02-16 14:32:30 +0200 )edit

Sort by ยป oldest newest most voted

Solutions to some equations involve a parameter.

These parameters are labeled $z_n$ if they are integer, or $r_n$ if they are real.

The indices don't have any specific meaning; they will vary everytime you solve. Their point is to distinguish parameters between them.

Using specific values for the parameters can be done as follows.

Give a name to each solution:

sage: sa, sb = (s.rhs() for s in sol)

sage: sa
pi + 2*pi*z1798
sage: sb
2*pi*z1816 + arctan(12/5)


Get the variables in each solution:

sage: sa.variables()
(z1798,)
sage: sa.variables()
(z1816,)


Give them easier names:

sage: za, = sa.variables()
sage: zb, = sb.variables()


Get the solution for $z_n = 0$:

sage: sa.subs({za: 0})
pi
sage: sb.subs({zb: 0})
arctan(12/5)


Get the solutions for a range of values of the parameters.

sage: [sa.subs({za: k}) for k in range(-3, 4)]
[-5*pi, -3*pi, -pi, pi, 3*pi, 5*pi, 7*pi]

sage: [sb.subs({zb: k}) for k in range(-3, 4)]
[-6*pi + arctan(12/5),
-4*pi + arctan(12/5),
-2*pi + arctan(12/5),
arctan(12/5),
2*pi + arctan(12/5),
4*pi + arctan(12/5),
6*pi + arctan(12/5)]

more