1 | initial version |
From the documentation of roots
:
Return roots of
self
that can be found exactly, possibly with multiplicities. Not all roots are guaranteed to be found.Warning: This is not a numerical solver
and
ring
- a ring (default None): if not None, convert self to a polynomial over ring and find roots over ring
The latter explains why you get the error in the title: the expression is not a polynomial, so the conversion fails.
The expression itself is only defined as a real number if y
is between 0 and 10 (due to the $\sqrt{y(10-y}$), so:
sage: var('y')
sage: f = sqrt(10*y*(10-y))+sqrt(1000)*acos(sqrt(y/10))-15*sqrt(2*6.673*10^(-11)*50000000000)
sage: f.find_root(0,10)
5.5672155196677675
sage: find_root(f,0,10)
5.5672155196677675
By plotting f
you see that it's the only root.
In general there is no magic method to find an interval where a root may live. It is however always a good idea to check the domain of definition first.
2 | No.2 Revision |
From the documentation of roots
:
Return roots of
self
that can be found exactly, possibly with multiplicities. Not all roots are guaranteed to be found.Warning: This is not a numerical solver
and
ring
- a ring (default None): if not None, convert self to a polynomial over ring and find roots over ring
The latter explains why you get the error in the title: the expression is not a polynomial, so the conversion fails.
The expression itself is only defined as a real number if y
is between 0 and 10 (due to the $\sqrt{y(10-y}$), $\sqrt{y(10-y)}$), so:
sage: var('y')
sage: f = sqrt(10*y*(10-y))+sqrt(1000)*acos(sqrt(y/10))-15*sqrt(2*6.673*10^(-11)*50000000000)
sage: f.find_root(0,10)
5.5672155196677675
sage: find_root(f,0,10)
5.5672155196677675
By plotting f
you see that it's the only root.
In general there is no magic method to find an interval where a root may live. It is however always a good idea to check the domain of definition first.