How to solve $(t +1) ^2=5$ in Sage?

199 Views Asked by At

I want to execute solve($(t+1)^2==5, t$) in Sage and using the Ring $\mathbb {Z}[X]/(x^2-2)$ so that $(t+1)^2$ evaluates to $2t+3$ and the solution of the solve is [t == 1].

My question is how to set up the domains in Sage prior to executing the solve function?

1

There are 1 best solutions below

2
On BEST ANSWER

You can't specify (or prespecify) a domain for solve. The best I could come up with is this snippet:

sage: R.<t> = PolynomialRing(ZZ)
sage: I = R.ideal([t^2-2])
sage: S.<z> = R.quotient_ring(I)
sage: eq_z = (z+1)^2-5; eq_z
2*z - 2
sage: eq_t = eq_z.lift(); eq_t
2*t - 2
sage: eq_t.roots()
[(1, 1)]

This means $t=1$ with multiplicity $1$.

If you really need eq_t as symbolic expression, you can do this:

sage: exp = SR(eq_t)
sage: solve(exp, exp.variables())
[t == 1]