Ask Your Question
1

Using "Z with subscript" parameters in `solve` solutions

asked 2022-02-16 12:16:00 +0200

prota gravatar image

updated 2022-02-16 14:28:20 +0200

slelievre gravatar image

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 flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

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

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

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

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

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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-02-16 14:22:04 +0200

slelievre gravatar image

updated 2022-02-16 14:27:05 +0200

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)]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-02-16 12:12:15 +0200

Seen: 35 times

Last updated: Feb 16