passagemath-repl 10.5.27__py3-none-any.whl → 10.5.29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/METADATA +38 -13
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/RECORD +95 -24
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/top_level.txt +1 -0
- sage/ext_data/all__sagemath_repl.py +1 -0
- sage/interfaces/all__sagemath_repl.py +1 -0
- sage/repl/ipython_kernel/install.py +6 -8
- sage/tests/books/__init__.py +2 -0
- sage/tests/books/computational-mathematics-with-sagemath/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py +549 -0
- sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1053 -0
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +443 -0
- sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +477 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +254 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +418 -0
- sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +290 -0
- sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +454 -0
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +421 -0
- sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +234 -0
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +560 -0
- sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +490 -0
- sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +155 -0
- sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +405 -0
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +180 -0
- sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +662 -0
- sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +392 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/calculus_doctest.py +264 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +217 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +59 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +141 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +105 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +53 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +56 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +56 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +25 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +47 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +115 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +111 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +167 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +107 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +58 -0
- sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
- sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +51 -0
- sage/tests/books/judson-abstract-algebra/actions-sage.py +173 -0
- sage/tests/books/judson-abstract-algebra/algcodes-sage.py +130 -0
- sage/tests/books/judson-abstract-algebra/boolean-sage.py +269 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +87 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage.py +170 -0
- sage/tests/books/judson-abstract-algebra/crypt-sage.py +151 -0
- sage/tests/books/judson-abstract-algebra/cyclic-sage.py +450 -0
- sage/tests/books/judson-abstract-algebra/domains-sage.py +163 -0
- sage/tests/books/judson-abstract-algebra/fields-sage.py +299 -0
- sage/tests/books/judson-abstract-algebra/finite-sage.py +108 -0
- sage/tests/books/judson-abstract-algebra/galois-sage.py +484 -0
- sage/tests/books/judson-abstract-algebra/groups-sage.py +280 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +65 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage.py +200 -0
- sage/tests/books/judson-abstract-algebra/integers-sage.py +197 -0
- sage/tests/books/judson-abstract-algebra/isomorph-sage.py +172 -0
- sage/tests/books/judson-abstract-algebra/normal-sage.py +133 -0
- sage/tests/books/judson-abstract-algebra/permute-sage.py +319 -0
- sage/tests/books/judson-abstract-algebra/poly-sage.py +300 -0
- sage/tests/books/judson-abstract-algebra/rings-sage.py +413 -0
- sage/tests/books/judson-abstract-algebra/sets-sage.py +163 -0
- sage/tests/books/judson-abstract-algebra/struct-sage.py +63 -0
- sage/tests/books/judson-abstract-algebra/sylow-sage.py +250 -0
- sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +48 -0
- sage/tests/books/judson-abstract-algebra/vect-sage.py +211 -0
- sage/tests/memcheck/__init__.py +1 -0
- sage/tests/memcheck/run_tests.py +25 -0
- sage/tests/memcheck/run_tests_in_valgrind.py +36 -0
- sage/tests/memcheck/symbolic_expression.py +12 -0
- sage/tests/memcheck/verify_no_leak.py +28 -0
- sage/tests/all.py +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/WHEEL +0 -0
@@ -0,0 +1,477 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
"""
|
3
|
+
This file (./float_doctest.sage) was *autogenerated* from ./float.tex,
|
4
|
+
with sagetex.sty version 2011/05/27 v2.3.1.
|
5
|
+
It contains the contents of all the sageexample environments from this file.
|
6
|
+
You should be able to doctest this file with:
|
7
|
+
sage -t ./float_doctest.sage
|
8
|
+
It is always safe to delete this file; it is not used in typesetting your
|
9
|
+
document.
|
10
|
+
|
11
|
+
Sage example in ./float.tex, line 251::
|
12
|
+
|
13
|
+
sage: xrdf = RDF(3.0)
|
14
|
+
|
15
|
+
Sage example in ./float.tex, line 276::
|
16
|
+
|
17
|
+
sage: R100 = RealField(100) # precision: 100 bits.
|
18
|
+
sage: x100 = R100(3/8); x100
|
19
|
+
0.37500000000000000000000000000
|
20
|
+
|
21
|
+
Sage example in ./float.tex, line 300::
|
22
|
+
|
23
|
+
sage: Rdefault = RealField() # default precision of 53 bits
|
24
|
+
sage: xdefault = Rdefault(2/3)
|
25
|
+
|
26
|
+
Sage example in ./float.tex, line 319::
|
27
|
+
|
28
|
+
sage: xrdf.prec()
|
29
|
+
53
|
30
|
+
sage: x100.prec()
|
31
|
+
100
|
32
|
+
sage: xdefault.prec()
|
33
|
+
53
|
34
|
+
|
35
|
+
Sage example in ./float.tex, line 347::
|
36
|
+
|
37
|
+
sage: x = 1.0; type(x)
|
38
|
+
<... 'sage.rings.real_mpfr.RealLiteral'>
|
39
|
+
sage: x.prec()
|
40
|
+
53
|
41
|
+
|
42
|
+
Sage example in ./float.tex, line 384::
|
43
|
+
|
44
|
+
sage: x = 1.0 # x belongs to RealField()
|
45
|
+
sage: x = 0.1e+1 # idem: x belongs to RealField()
|
46
|
+
sage: x = 1 # x is an integer
|
47
|
+
sage: x = RDF(1) # x is a machine double-precision number
|
48
|
+
sage: x = RDF(1.) # idem: x is a machine double-precision number
|
49
|
+
sage: x = RDF(0.1e+1) # idem
|
50
|
+
sage: x = 4/3 # x is a rational number
|
51
|
+
sage: R = RealField(20)
|
52
|
+
sage: x = R(1) # x is a 20-bit floating-point number
|
53
|
+
|
54
|
+
Sage example in ./float.tex, line 400::
|
55
|
+
|
56
|
+
sage: RDF(8/3)
|
57
|
+
2.6666666666666665
|
58
|
+
sage: R100 = RealField(100); R100(8/3)
|
59
|
+
2.6666666666666666666666666667
|
60
|
+
|
61
|
+
Sage example in ./float.tex, line 412::
|
62
|
+
|
63
|
+
sage: x = R100(8/3)
|
64
|
+
sage: R = RealField(); R(x)
|
65
|
+
2.66666666666667
|
66
|
+
sage: RDF(x)
|
67
|
+
2.6666666666666665
|
68
|
+
|
69
|
+
Sage example in ./float.tex, line 431::
|
70
|
+
|
71
|
+
sage: 1.0/0.0
|
72
|
+
+infinity
|
73
|
+
sage: RDF(1)/RDF(0)
|
74
|
+
+infinity
|
75
|
+
sage: RDF(-1.0)/RDF(0.)
|
76
|
+
-infinity
|
77
|
+
|
78
|
+
Sage example in ./float.tex, line 441::
|
79
|
+
|
80
|
+
sage: 0.0/0.0
|
81
|
+
NaN
|
82
|
+
sage: RDF(0.0)/RDF(0.0)
|
83
|
+
NaN
|
84
|
+
|
85
|
+
Sage example in ./float.tex, line 496::
|
86
|
+
|
87
|
+
sage: R2 = RealField(2)
|
88
|
+
|
89
|
+
Sage example in ./float.tex, line 545::
|
90
|
+
|
91
|
+
sage: x2 = R2(1.); x2.ulp()
|
92
|
+
0.50
|
93
|
+
sage: xr = 1.; xr.ulp()
|
94
|
+
2.22044604925031e-16
|
95
|
+
|
96
|
+
Sage example in ./float.tex, line 655::
|
97
|
+
|
98
|
+
sage: a = 10000.0; b = 9999.5; c = 0.1; c
|
99
|
+
0.100000000000000
|
100
|
+
sage: a1 = a+c # add a small perturbation to a.
|
101
|
+
sage: a1-b
|
102
|
+
0.600000000000364
|
103
|
+
|
104
|
+
Sage example in ./float.tex, line 680::
|
105
|
+
|
106
|
+
sage: a = 1.0; b = 10.0^4; c = 1.0
|
107
|
+
sage: delta = b^2-4*a*c
|
108
|
+
sage: x = (-b-sqrt(delta))/(2*a); y = (-b+sqrt(delta))/(2*a)
|
109
|
+
sage: x, y
|
110
|
+
(-9999.99990000000, -0.000100000001111766)
|
111
|
+
|
112
|
+
Sage example in ./float.tex, line 692::
|
113
|
+
|
114
|
+
sage: x+y+b/a
|
115
|
+
0.000000000000000
|
116
|
+
sage: x*y-c/a
|
117
|
+
1.11766307320238e-9
|
118
|
+
|
119
|
+
Sage example in ./float.tex, line 713::
|
120
|
+
|
121
|
+
sage: y = (c/a)/x; y
|
122
|
+
-0.000100000001000000
|
123
|
+
sage: x+y+b/a
|
124
|
+
0.000000000000000
|
125
|
+
sage: x*y-c/a
|
126
|
+
-1.11022302462516e-16
|
127
|
+
|
128
|
+
Sage example in ./float.tex, line 746::
|
129
|
+
|
130
|
+
sage: x1 = R2(1/2); x2 = R2(4); x3 = R2(-4)
|
131
|
+
sage: x1, x2, x3
|
132
|
+
(0.50, 4.0, -4.0)
|
133
|
+
sage: x1+(x2+x3)
|
134
|
+
0.50
|
135
|
+
sage: (x1+x2)+x3
|
136
|
+
0.00
|
137
|
+
|
138
|
+
Sage example in ./float.tex, line 781::
|
139
|
+
|
140
|
+
sage: x = RDF(1/3)
|
141
|
+
sage: for i in range(1,100): x = 4*x-1; print(x)
|
142
|
+
0.33333333333333326
|
143
|
+
0.33333333333333304
|
144
|
+
0.33333333333333215
|
145
|
+
...
|
146
|
+
-1.0
|
147
|
+
-5.0
|
148
|
+
-21.0
|
149
|
+
-85.0
|
150
|
+
-341.0
|
151
|
+
-1365.0
|
152
|
+
-5461.0
|
153
|
+
-21845.0
|
154
|
+
...
|
155
|
+
|
156
|
+
Sage example in ./float.tex, line 824::
|
157
|
+
|
158
|
+
sage: x = RDF(1/2)
|
159
|
+
sage: for i in range(1,100): x = 3*x-1; print(x)
|
160
|
+
0.5
|
161
|
+
0.5
|
162
|
+
0.5
|
163
|
+
...
|
164
|
+
0.5
|
165
|
+
|
166
|
+
Sage example in ./float.tex, line 863::
|
167
|
+
|
168
|
+
sage: x = RDF(1/3)
|
169
|
+
|
170
|
+
Sage example in ./float.tex, line 867::
|
171
|
+
|
172
|
+
sage: x = 1/3
|
173
|
+
|
174
|
+
Sage example in ./float.tex, line 990::
|
175
|
+
|
176
|
+
sage: def sumharmo(p):
|
177
|
+
....: RFP = RealField(p)
|
178
|
+
....: y = RFP(1.); x = RFP(0.); n = 1
|
179
|
+
....: while x != y:
|
180
|
+
....: y = x; x += 1/n; n += 1
|
181
|
+
....: return p, n, x
|
182
|
+
|
183
|
+
Sage example in ./float.tex, line 1003::
|
184
|
+
|
185
|
+
sage: sumharmo(2)
|
186
|
+
(2, 5, 2.0)
|
187
|
+
sage: sumharmo(20)
|
188
|
+
(20, 131073, 12.631)
|
189
|
+
|
190
|
+
Sage example in ./float.tex, line 1072::
|
191
|
+
|
192
|
+
sage: def iter(y, delta, a, n):
|
193
|
+
....: for i in range(0,n):
|
194
|
+
....: y += delta
|
195
|
+
....: delta *= a
|
196
|
+
....: return y
|
197
|
+
|
198
|
+
Sage example in ./float.tex, line 1087::
|
199
|
+
|
200
|
+
sage: def exact(y, delta, a, n):
|
201
|
+
....: return y+delta*(1-a^n)/(1-a)
|
202
|
+
|
203
|
+
Sage example in ./float.tex, line 1106::
|
204
|
+
|
205
|
+
sage: y0 = RDF(10^13); delta0 = RDF(1); a = RDF(1-10^(-8)); n = 100000
|
206
|
+
sage: ii = iter(y0,delta0,a,n)
|
207
|
+
sage: s = exact(10^13,1,1-10^(-8),n)
|
208
|
+
sage: print("exact - classical summation: %.1f" % (s-ii)) # abs tol 0.1
|
209
|
+
exact - classical summation: -45.6
|
210
|
+
|
211
|
+
Sage example in ./float.tex, line 1128::
|
212
|
+
|
213
|
+
sage: def sumcomp(y, delta, e, n, a):
|
214
|
+
....: for i in range(0,n):
|
215
|
+
....: b = y
|
216
|
+
....: e += delta
|
217
|
+
....: y = b+e
|
218
|
+
....: e += (b-y)
|
219
|
+
....: delta = a*delta # new value of delta
|
220
|
+
....: return y
|
221
|
+
|
222
|
+
Sage example in ./float.tex, line 1194::
|
223
|
+
|
224
|
+
sage: c = sumcomp(y0,delta0,RDF(0.0),n,a)
|
225
|
+
sage: print("exact - compensated summation: %.5f" \
|
226
|
+
....: % RDF(s-RR(c).exact_rational()))
|
227
|
+
exact - compensated summation: -0.00042
|
228
|
+
|
229
|
+
Sage example in ./float.tex, line 1242::
|
230
|
+
|
231
|
+
sage: x = CDF(2,1.); x
|
232
|
+
2.0 + 1.0*I
|
233
|
+
sage: y = CDF(20,0); y
|
234
|
+
20.0
|
235
|
+
|
236
|
+
Sage example in ./float.tex, line 1249::
|
237
|
+
|
238
|
+
sage: z = ComplexDoubleElement(2.,1.); z
|
239
|
+
2.0 + 1.0*I
|
240
|
+
|
241
|
+
Sage example in ./float.tex, line 1269::
|
242
|
+
|
243
|
+
sage: C = ComplexField(); C(2,3)
|
244
|
+
2.00000000000000 + 3.00000000000000*I
|
245
|
+
sage: C100 = ComplexField(100); C100(2,3)
|
246
|
+
2.0000000000000000000000000000 + 3.0000000000000000000000000000*I
|
247
|
+
|
248
|
+
Sage example in ./float.tex, line 1297::
|
249
|
+
|
250
|
+
sage: R200 = RealField(200); R200.pi()
|
251
|
+
3.1415926535897932384626433832795028841971693993751058209749
|
252
|
+
sage: R200.euler_constant()
|
253
|
+
0.57721566490153286060651209008240243104215933593992359880577
|
254
|
+
|
255
|
+
Sage example in ./float.tex, line 1314::
|
256
|
+
|
257
|
+
sage: x = RDF.pi()/2; x.cos() # floating-point approximation of zero!
|
258
|
+
6.123233995736757e-17
|
259
|
+
sage: x.cos().arccos() - x
|
260
|
+
0.0
|
261
|
+
|
262
|
+
Sage example in ./float.tex, line 1564::
|
263
|
+
|
264
|
+
sage: r3 = RIF(sqrt(3)); r3
|
265
|
+
1.732050807568877?
|
266
|
+
sage: print(r3.str(style='brackets'))
|
267
|
+
[1.7320508075688769 .. 1.7320508075688775]
|
268
|
+
|
269
|
+
Sage example in ./float.tex, line 1602::
|
270
|
+
|
271
|
+
sage: sage.rings.real_mpfi.printing_style = 'brackets'
|
272
|
+
|
273
|
+
Sage example in ./float.tex, line 1616::
|
274
|
+
|
275
|
+
sage: r2 = RIF(2); r2, r2.diameter()
|
276
|
+
([2.0000000000000000 .. 2.0000000000000000], 0.000000000000000)
|
277
|
+
|
278
|
+
Sage example in ./float.tex, line 1628::
|
279
|
+
|
280
|
+
sage: rpi = RIF(sqrt(2),pi); rpi
|
281
|
+
[1.4142135623730949 .. 3.1415926535897936]
|
282
|
+
sage: RIF(0,+infinity)
|
283
|
+
[0.0000000000000000 .. +infinity]
|
284
|
+
|
285
|
+
Sage example in ./float.tex, line 1649::
|
286
|
+
|
287
|
+
sage: RBF(pi)
|
288
|
+
[3.141592653589793 +/- ...e-16]
|
289
|
+
sage: RealBallField(100)(pi)
|
290
|
+
[3.14159265358979323846264338328 +/- ...e-30]
|
291
|
+
|
292
|
+
Sage example in ./float.tex, line 1662::
|
293
|
+
|
294
|
+
sage: RBF(2).rad()
|
295
|
+
0.00000000
|
296
|
+
|
297
|
+
Sage example in ./float.tex, line 1675::
|
298
|
+
|
299
|
+
sage: si = sin(RIF(pi))
|
300
|
+
sage: si.contains_zero()
|
301
|
+
True
|
302
|
+
sage: sb = sin(RBF(pi))
|
303
|
+
sage: sb.contains_zero()
|
304
|
+
True
|
305
|
+
|
306
|
+
Sage example in ./float.tex, line 1704::
|
307
|
+
|
308
|
+
sage: a = RealIntervalField(30)(1, RR(1).nextabove())
|
309
|
+
sage: a.bisection()
|
310
|
+
([1.0000000000 .. 1.0000000000], [1.0000000000 .. 1.0000000019])
|
311
|
+
|
312
|
+
Sage example in ./float.tex, line 1713::
|
313
|
+
|
314
|
+
sage: b = RealIntervalField(2)(-1,6)
|
315
|
+
sage: b.center(), b.diameter()
|
316
|
+
(2.0, 8.0)
|
317
|
+
|
318
|
+
Sage example in ./float.tex, line 1725::
|
319
|
+
|
320
|
+
sage: s = RIF(1,2)
|
321
|
+
sage: b = RBF(s)
|
322
|
+
sage: bpi = RBF(pi)
|
323
|
+
sage: ipi = RIF(bpi)
|
324
|
+
|
325
|
+
Sage example in ./float.tex, line 1735::
|
326
|
+
|
327
|
+
sage: RIF(RBF(RIF(1,2))) == RIF(1,2)
|
328
|
+
False
|
329
|
+
sage: RBF(RIF(RBF(pi))) == RBF(pi)
|
330
|
+
False
|
331
|
+
|
332
|
+
Sage example in ./float.tex, line 1810::
|
333
|
+
|
334
|
+
sage: E = RIF(-pi/4,pi)
|
335
|
+
sage: sin(E)
|
336
|
+
[-0.70710678118654769 .. 1.0000000000000000]
|
337
|
+
sage: E = RIF(-1,2); exp(E)
|
338
|
+
[0.36787944117144227 .. 7.3890560989306505]
|
339
|
+
sage: E = RIF(0,1); log(E)
|
340
|
+
[-infinity .. -0.0000000000000000]
|
341
|
+
|
342
|
+
Sage example in ./float.tex, line 1838::
|
343
|
+
|
344
|
+
sage: E=RIF(-pi,pi)
|
345
|
+
sage: f = lambda x: sin(x)/x
|
346
|
+
sage: f(E)
|
347
|
+
[-infinity .. +infinity]
|
348
|
+
|
349
|
+
Sage example in ./float.tex, line 1913::
|
350
|
+
|
351
|
+
sage: x = RIF(-1,1)
|
352
|
+
sage: 1-x^2
|
353
|
+
[0.0000000000000000 .. 1.0000000000000000]
|
354
|
+
sage: 1-x*x
|
355
|
+
[0.0000000000000000 .. 2.0000000000000000]
|
356
|
+
sage: (1-x)*(1+x)
|
357
|
+
[0.0000000000000000 .. 4.0000000000000000]
|
358
|
+
|
359
|
+
Sage example in ./float.tex, line 1975::
|
360
|
+
|
361
|
+
sage: def bisect(funct, x, tol, zeros):
|
362
|
+
....: if 0 in funct(x):
|
363
|
+
....: if x.diameter()>tol:
|
364
|
+
....: x1,x2 = x.bisection()
|
365
|
+
....: bisect(funct,x1,tol,zeros)
|
366
|
+
....: bisect(funct,x2,tol,zeros)
|
367
|
+
....: else:
|
368
|
+
....: zeros.append(x)
|
369
|
+
sage: sage.rings.real_mpfi.printing_style = 'question'
|
370
|
+
sage: fs = lambda x: sin(1/x)
|
371
|
+
sage: d = RealIntervalField(100)(1/64,1/32)
|
372
|
+
sage: zeros = []
|
373
|
+
sage: bisect(fs,d,10^(-25),zeros)
|
374
|
+
sage: for s in zeros:
|
375
|
+
....: s
|
376
|
+
0.015915494309189533576888377?
|
377
|
+
0.01675315190441003534409303?
|
378
|
+
0.01768388256576614841876487?
|
379
|
+
0.018724110951987686561045148?
|
380
|
+
0.01989436788648691697111047?
|
381
|
+
0.021220659078919378102517835?
|
382
|
+
0.02273642044169933368126911?
|
383
|
+
0.024485375860291590118289809?
|
384
|
+
0.026525823848649222628147293?
|
385
|
+
0.02893726238034460650343342?
|
386
|
+
sage: dfs = lambda x: -cos(1/x)/x^2
|
387
|
+
sage: not any(dfs(z).contains_zero() for z in zeros)
|
388
|
+
True
|
389
|
+
|
390
|
+
Sage example in ./float.tex, line 2022::
|
391
|
+
|
392
|
+
sage: def NearlySingularMatrix(R, n):
|
393
|
+
....: M=matrix(R,n,n)
|
394
|
+
....: for i in range(0,n):
|
395
|
+
....: for j in range(0,n):
|
396
|
+
....: M[i,j]= (1+log(R(1+i)))/((i+1)^2+(j+1)^2)
|
397
|
+
....: return M
|
398
|
+
|
399
|
+
Sage example in ./float.tex, line 2044::
|
400
|
+
|
401
|
+
sage: n=35
|
402
|
+
sage: NearlySingularMatrix(RDF,n).det() == 0.0
|
403
|
+
True
|
404
|
+
|
405
|
+
Sage example in ./float.tex, line 2053::
|
406
|
+
|
407
|
+
sage: NearlySingularMatrix(RBF,n).det().contains_zero()
|
408
|
+
True
|
409
|
+
|
410
|
+
Sage example in ./float.tex, line 2064::
|
411
|
+
|
412
|
+
sage: def tryDet(R, n):
|
413
|
+
....: p = 53
|
414
|
+
....: z = True
|
415
|
+
....: while z:
|
416
|
+
....: p += 100
|
417
|
+
....: MRF=NearlySingularMatrix(R(p),n)
|
418
|
+
....: d = MRF.det()
|
419
|
+
....: z = d.contains_zero()
|
420
|
+
....: return p,d
|
421
|
+
sage: tryDet(RealBallField,n) # long time
|
422
|
+
(1653, [9.552323592707808e-485 +/- 1.65e-501])
|
423
|
+
|
424
|
+
Sage example in ./float.tex, line 2095::
|
425
|
+
|
426
|
+
sage: tryDet(RealIntervalField,n) # long time
|
427
|
+
(1653, 9.552323592707808?e-485)
|
428
|
+
|
429
|
+
Sage example in ./float.tex, line 2135::
|
430
|
+
|
431
|
+
sage: CBF(sqrt(2),pi)
|
432
|
+
[1.414213562373095...] + [3.141592653589793...]*I
|
433
|
+
sage: CIF(sqrt(2),pi)
|
434
|
+
1.414213562373095? + 3.141592653589794?*I
|
435
|
+
sage: CIF(sqrt(2)+pi*I)
|
436
|
+
1.414213562373095? + 3.141592653589794?*I
|
437
|
+
sage: CBF(sqrt(2)+pi*I)
|
438
|
+
[1.414213562373095...] + [3.141592653589793...]*I
|
439
|
+
|
440
|
+
Sage example in ./float.tex, line 2146::
|
441
|
+
|
442
|
+
sage: sage.rings.real_mpfi.printing_style = 'brackets'
|
443
|
+
|
444
|
+
Sage example in ./float.tex, line 2149::
|
445
|
+
|
446
|
+
sage: c = CIF(RIF(1,2),RIF(-3,3))
|
447
|
+
sage: c.real()
|
448
|
+
[1.0000000000000000 .. 2.0000000000000000]
|
449
|
+
sage: c.imag()
|
450
|
+
[-3.0000000000000000 .. 3.0000000000000000]
|
451
|
+
sage: CBF(RIF(1,2),RIF(-3,3))
|
452
|
+
[+/- 2.01] + [+/- 3.01]*I
|
453
|
+
|
454
|
+
Sage example in ./float.tex, line 2164::
|
455
|
+
|
456
|
+
sage: sage.rings.real_mpfi.printing_style = 'question'
|
457
|
+
|
458
|
+
Sage example in ./float.tex, line 2167::
|
459
|
+
|
460
|
+
sage: ComplexIntervalField(100)(1+I*pi).arg()
|
461
|
+
1.26262725567891168344432208361?
|
462
|
+
sage: ComplexBallField(100)(1+I*pi).arg()
|
463
|
+
[1.26262725567891168344432208360 +/- ...e-30]
|
464
|
+
sage: ComplexIntervalField(100)(1+I*pi).norm()
|
465
|
+
10.8696044010893586188344909999?
|
466
|
+
|
467
|
+
Sage example in ./float.tex, line 2242::
|
468
|
+
|
469
|
+
sage: sage.rings.real_mpfi.printing_style = 'question'
|
470
|
+
|
471
|
+
Sage example in ./float.tex, line 2245::
|
472
|
+
|
473
|
+
sage: x=QQbar(sqrt(3)); x
|
474
|
+
1.732050807568878?
|
475
|
+
sage: x.interval(RealIntervalField(100))
|
476
|
+
1.73205080756887729352744634151?
|
477
|
+
"""
|