Solutions are retrieved with the symbol

12 views
Skip to first unread message

Peleg Michaeli

unread,
Dec 21, 2016, 8:36:41 AM12/21/16
to sage-support
I am trying to solve the following equation:

    -1/2*sqrt(-4*p^2 + 4*p + 1)*p + 1/2*p = 1/2

I was trying the following:

sage: var('p')
p
sage
: solve(-1/2*sqrt(-4*p^2 + 4*p + 1)*p + 1/2*p == 1/2, p)
[p == -1/(sqrt(-4*p^2 + 4*p + 1) - 1)]

So the solution is p = some expression of p. Not very useful. Wolfram Alpha, for example, gives the following solution:

    1/4 + 1/4 (sqrt(5) + sqrt(2 (-1 + sqrt(5))))

(along with some complex solutions)

I do get a proper solution if I use `to_poly_solve=True` in the call to solve.

Am I doing it wrong? Should I, for some reason, always use Maxima's solver?


Thanks,
Peleg.

Vincent Delecroix

unread,
Dec 21, 2016, 12:27:34 PM12/21/16
to sage-s...@googlegroups.com
You can at least obtain the solutions via

sage: Eq = -1/2*sqrt(-4*p^2 + 4*p + 1)*p + 1/2*p == 1/2
sage: (((2*Eq -p)/p)**2)
-4*p^2 + 4*p + 1 == (p - 1)^2/p^2
sage: (((2*Eq -p)/p)**2).solve(p)
[p == -1/4*sqrt(5) - 1/2*sqrt(-1/2*sqrt(5) - 1/2) + 1/4,
p == -1/4*sqrt(5) + 1/2*sqrt(-1/2*sqrt(5) - 1/2) + 1/4,
p == 1/4*sqrt(5) - 1/2*sqrt(1/2*sqrt(5) - 1/2) + 1/4,
p == 1/4*sqrt(5) + 1/2*sqrt(1/2*sqrt(5) - 1/2) + 1/4]
Reply all
Reply to author
Forward
0 new messages