Ask Your Question

Revision history [back]

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(za=0)
pi
sage: sb(zb=0)
arctan(12/5)

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

sage: [sa(za=k) for k in range(-3, 4)]
[pi + 2*pi*z1798,
 pi + 2*pi*z1798,
 pi + 2*pi*z1798,
 pi + 2*pi*z1798,
 pi + 2*pi*z1798,
 pi + 2*pi*z1798,
 pi + 2*pi*z1798]
sage: [sb(zb=k) for k in range(-3, 4)]
[2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5)]

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(za=0)
sa.subs({za: 0})
pi
sage: sb(zb=0)
sb.subs({zb: 0})
arctan(12/5)

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

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

sage: [sb.subs({zb: k}) for k in range(-3, 4)]
[2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 + arctan(12/5),
 2*pi*z1816 [-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)]