Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit bb1447d

Browse files
committed
Minor doc upgrades for #1678
1 parent 4cd153a commit bb1447d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/doc/en/tutorial/interactive_shell.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ i.e., the amount of time that elapsed on your wall clock, is also
262262
0.66 seconds. If your computer is heavily loaded with other
263263
programs, the wall time may be much larger than the CPU time.
264264

265+
It's also possible to use the ``timeit`` function to try to get
266+
timing over a large number of iterations of a command. This gives
267+
slightly different information, and requires the input of a string
268+
with the command you want to time.
269+
270+
.. skip
271+
272+
::
273+
274+
sage: timeit("int(1938)^int(99484)")
275+
5 loops, best of 3: 44.8 ms per loop
276+
265277
Next we time exponentiation using the native Sage Integer type,
266278
which is implemented (in Cython) using the GMP library:
267279

src/sage/functions/other.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,8 +1735,23 @@ def sqrt(x, *args, **kwds):
17351735
[2, -2]
17361736
sage: sqrt(x^2)
17371737
sqrt(x^2)
1738+
1739+
For a non-symbolic square root, there are a few options.
1740+
The best is to numerically approximate afterward::
1741+
17381742
sage: sqrt(2).n()
17391743
1.41421356237310
1744+
sage: sqrt(2).n(prec=100)
1745+
1.4142135623730950488016887242
1746+
1747+
Or one can input a numerical type.
1748+
1749+
sage: sqrt(2.)
1750+
1.41421356237310
1751+
sage: sqrt(2.000000000000000000000000)
1752+
1.41421356237309504880169
1753+
sage: sqrt(4.0)
1754+
2.00000000000000
17401755
17411756
To prevent automatic evaluation, one can use the ``hold`` parameter
17421757
after coercing to the symbolic ring::

0 commit comments

Comments
 (0)