Processing math: 100%

PPPK_03

264 days ago by fresl

 

Algebarske strukture

 


MonoidM=(S,), pri čemu su S skup i binarna operacija

  1. zatvorenost:  x,ySxyS
  2. asocijativnost:  (xy)z=x(yz)
  3. neutralni (jedinični) element:  eS:xe=ex=xxS

 

GrupaG=(S,)

  1. monoid 
  2. inverzni element:  xSyA:xy=yx=e;    česte oznake:  y=x1 ili y=x

 

Abelova ili komutativna grupa

  1. grupa
  2. komutativnost: xy=yx


Primjeri

  • skupovi Z,Q,R i operacija + :   Abelove grupe
  • skup N0=N{0} i operacija + :   monoid u kojem vrijedi komutativnost (nije grupa jer nema inverznog elementa)
  • skupovi Q{0},R{0},Q+,R+ i operacija :   Abelove grupe
  • skup regularnih matrica tipa n×n i operacija množenja :   grupa (ali ne Abelova, jer ABBA)
  • skup bijekcija na skupu S i kompozicija funkcija :   grupa (ali ne Abelova, jer fggf za f,g:SS)

 

Prsten: R=(S,+,), pri čemu su + i binarne operacije

  1. zatvorenost obje operacije
  2. (S,+)  Abelova grupa
  3. asocijativnost operacije
  4. distributivnost:  x(y+z)=xy+xz  i  (x+y)z=xz+yz

 

Komutativni prsten

  1. prsten
  2. komutativnost operacije

 

Prsten s jedinicom

  1. prsten
  2. neutralni element za :   x1=1x=x; 10,  gdje je 0 neutralni element za +

 

Prsten s dijeljenjem

  1. prsten s jedinicom
  2. inverzni element za :   x0y:xy=yx=1

 

Polje — komutativni prsten s dijeljenjem


Primjeri

  • (N0,+,)  komutativni poluprsten s jedinicom (poluprsten ima svojstva prstena, osim što je 2. slabije: (S,+)  komutativni monoid)
  • (Z,+,)  komutativni prsten s jedinicom
  • (Q,+,),   (R,+,)(C,+,)  polja
  • regularne matrice tipa n×n s operacijama zbrajanja i množenja :  prsten s dijeljenjem (množenje nije komutativno)

 

Vektorski prostor V nad poljem S:   (V,S,+,), pri čemu su

  • V  -  skup vektora,
  • S  -  polje skalara
  • +  -  zbrajanje vektora  +:V×VV,
  •   -  množenje skalarom   :S×VV
  1. zbrajanje je Abelova grupa (neutralni element  0,  inverzni element  x)
  2. zatvorenost množenja skalarom:  αS,xVαx=αxV
  3. (αβ)x=α(βx)α,βSixV
  4. α(x+y)=αx+αyαSix,yV
  5. (α+β)x=αx+βxα,βSixV
  6. 1S:1x=xxV

 

Primjeri

  • „klasični” vektori u ravnini i prostoru (nad poljem R
  • poopćenje „klasičnih” vektora u n-dimenzionalnom prostoru Rn
  • matrice tipa m×n (nad poljem R)
  • skup svih funkcija  f:[0,1]R,  pri čemu su  (f+g)(x)=f(x)+g(x)  i  (αf)(x)=αf(x)  za αR
  • skup svih neprekinutih funkcija  f:[0,1]R
  • skup svih funkcija  f:[0,1]R s neprekinutom prvom derivacijom
  • skup svih polinoma s realnim koeficijentima


Slobodni modul(V,S,+,), ali je, za razliku od vektorskog prostora, S prsten s jedinicom

 

Algebra (nad poljem):  vektorski prostor s množenjem

 

Primjeri

  • kompleksni brojevi — komutativna asocijativna algebra
  • matrice tipa n×n — nekomutativna asocijativna algebra
  • prostor R3 s vektorskim produktom — nekomutativna neasocijativna algebra

 

       
1
1
       
Integer Ring
Integer Ring
       
Integer Ring
Integer Ring
       
1/2
1/2
       
12

                                
       
Rational Field
Rational Field
       
1.00000000000000
1.00000000000000
       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
       
Real Field with 80 bits of precision
Real Field with 80 bits of precision
       
1.0000000000000000000000
1.0000000000000000000000
       
Real Field with 80 bits of precision
Real Field with 80 bits of precision
       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
       
Complex Field with 53 bits of precision
Complex Field with 53 bits of precision

 

Oznake skupova brojeva:

  • ZZ  —  Z, prsten cijelih brojeva (Integer Ring
  • QQ  —  Q, polje racionalnih brojeva (Rational Field)
  • RR  —  R, polje realnih brojeva (Real Field) s točnošću zapisa od 53 bita (približno 16 značajnih dekadskih znamenaka)
  • RealField (n)  —  R, polje realnih brojeva (Real Field) s točnošću zapisa od n bitova  (približno nlog102  značajnih dekadskih znamenaka)
  • CC  —  C, polje kompleksnih brojeva (Complex Field) s točnošću zapisa od 53 bita za realni i za imaginarni dio

 

       
(0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000,
0.000000000000000)
(0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000)
       
Vector space of dimension 5 over Real Field with 53 bits of precision
Vector space of dimension 5 over Real Field with 53 bits of precision
       
(0.00000000000000000000000, 0.00000000000000000000000,
0.00000000000000000000000, 0.00000000000000000000000, 0.00000000000000000000000)
(0.00000000000000000000000, 0.00000000000000000000000, 0.00000000000000000000000, 0.00000000000000000000000, 0.00000000000000000000000)
       
Vector space of dimension 5 over Real Field with 80 bits of precision
Vector space of dimension 5 over Real Field with 80 bits of precision
       
(0.000, 0.000, 0.000, 0.000, 0.000)
(0.000, 0.000, 0.000, 0.000, 0.000)
       
Vector space of dimension 5 over Real Field with 14 bits of precision
Vector space of dimension 5 over Real Field with 14 bits of precision
       
(1/2, 2/3, 3/4)
(1/2, 2/3, 3/4)
       
(12,23,34)

                                
       
Vector space of dimension 3 over Rational Field
Vector space of dimension 3 over Rational Field
       
Vector space of dimension 2 over Real Field with 53 bits of precision
Vector space of dimension 2 over Real Field with 53 bits of precision
       
(0.500000000000000, 0.500000000000000)
(0.500000000000000, 0.500000000000000)
       
(13, 14, 15)
Ambient free module of rank 3 over the principal ideal domain Integer Ring
(13, 14, 15)
Ambient free module of rank 3 over the principal ideal domain Integer Ring
       
Ambient free module of rank 3 over the principal ideal domain Integer Ring
Ambient free module of rank 3 over the principal ideal domain Integer Ring
       
[ 1.00000000000000 0.000000000000000 0.000000000000000]
[0.000000000000000  1.00000000000000 0.000000000000000]
[0.000000000000000 0.000000000000000  1.00000000000000]
[ 1.00000000000000 0.000000000000000 0.000000000000000]
[0.000000000000000  1.00000000000000 0.000000000000000]
[0.000000000000000 0.000000000000000  1.00000000000000]
       
Full MatrixSpace of 3 by 3 dense matrices over Real Field with 53 bits of
precision
Full MatrixSpace of 3 by 3 dense matrices over Real Field with 53 bits of precision
       
(0.946506025948392435985480.708789360397446770179030.604561034244539006781870.141208339194225174951530.432195279952402993318880.704836089489321002979570.342478034045933685707880.684451996074528184530110.803207047228001206742450.427309054162640942404160.998906404619708510491340.90340163985851571211700)

                                
       
Full MatrixSpace of 4 by 3 dense matrices over Real Field with 80 bits of
precision
Full MatrixSpace of 4 by 3 dense matrices over Real Field with 80 bits of precision


Cijeli brojevi

       
10
10
       
6
6
       
13/2
13/2
       
6
6
       
1
1
       
(6, 1)
(6, 1)
       
13
13
       
6.50000000000000
6.50000000000000
       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
       
6.5
6.5
       
Real Field with 10 bits of precision
Real Field with 10 bits of precision
       
302875106592253
302875106592253
       
1/302875106592253
1/302875106592253
       
3.30169095523012e-15
3.30169095523012e-15
       
'1000111'
'1000111'

binarni prikaz:

(1000111)2=120+121+122+023+024+025+126=1+2+4+08+016+032+64=71

       
'-1000111'
'-1000111'
       
'11111111111111111111111110111001'
'11111111111111111111111110111001'

dvojni komplement:

negativni broj x:    232x

 

+(100000000000000000000000001000111)2

+(111111111111111111111111110111001)2

=(100000000000000000000000000000000)2

 

xy=x+(y):    x+(232y)=232(yx)

 

 

„Realni” brojevi

 

I am HAL Nine Thousand computer Production Number 3. I became operational at the Hal Plant in Urbana, Illinois, on January 12, 1997.

The quick brown fox jumps over the lazy dog.

The rain in Spain is mainly in the plain.

Dave—are you still here?

Did you know that the square root of 10 is 3.162277660168379?

Log 10 to the base e is 0.43429481903252

correction, that is log e to the base 10

The reciprocal of 3 is 0.3333333333333333333

2 times 2 is2 times 2 is

approximately 4.10101010101010

I seem to be having difficulty

 

—HAL, in 2001: A Space Odyssey


       
6.50000000000000
6.50000000000000
       
6.50000000000000
6.50000000000000
       
6.50000000000000
6.50000000000000

 

„Realne” se konstante (s točnošću zapisa od 53 bita) mogu pisati na pet načina:

  • kao decimalni brojevi s točkom (može se izostaviti dio ispred ili iza točke, ali točka mora postojati, jer je inače riječ o cijelom broju):
       
(3.14000000000000, -1.41000000000000, 0.000000000000000, 0.510000000000000)
(3.14000000000000, -1.41000000000000, 0.000000000000000, 0.510000000000000)
  • u eksponencijalnom obliku:
       
(1.30000000000000e13, 1.30000000000000e-13)
(1.30000000000000e13, 1.30000000000000e-13)
  • pomoću funkcije RR():
       
(1.00000000000000, 0.500000000000000)
(1.00000000000000, 0.500000000000000)
  • pomoću funkcija N(), n(), numerical_approx():
       
(0.500000000000000,
 0.333333333333333,
 0.250000000000000,
 0.0909090909090909,
 0.0769230769230769)
(0.500000000000000,
 0.333333333333333,
 0.250000000000000,
 0.0909090909090909,
 0.0769230769230769)
       
(-1.0, -0.3333333333333333, -0.25)
(-1.0, -0.3333333333333333, -0.25)

Prva četiri načina daju brojeve koji pripadaju tipu RealField(53), a peti broj koji pripada tipu RealDoubleField:

       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Double Field
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Field with 53 bits of precision
Real Double Field

Pomoću funkcija RealField()() i N() mogu se zadati „realni” brojevi drugih točnosti:

       
-1.20
-1.20
       
Real Field with 170 bits of precision
Real Field with 170 bits of precision
       
-1.2000000000000000000000000000000000000000000000000
-1.2000000000000000000000000000000000000000000000000
       
-1.2000000000000000000000000000000000000000000000000
-1.2000000000000000000000000000000000000000000000000
       
-1.2000000000000000000000000000000000000000000000000
-1.2000000000000000000000000000000000000000000000000

 

Realni brojevi (u matematici):

  • neprebrojivi (kardinalni broj skupa R: C=20), 
  • racionalni i iracionalni (2,π,e)

Racionalni brojevi:

  • prebrojivi (kardinalni broj skupova N,Z i Q: 0),
  • mogu se napisati u obliku mn, gdje su mZ i nN,
  • ovisno o bazi, u zapisu sa zarezom (ili, u engleskom, s točkom) mogu imati konačan ili beskonačan broj znamenaka; ako je znamenaka beskonačno mnogo, one se prije ili kasnije počnu ponavljati:  13=0,333=0,˙3110=0,1=(0,00011001100110011)2=(0,0¯0011)2
       
13/7
13/7
       
1.85714285714286
1.85714285714286
       
18.5714285714286
18.5714285714286
       
18571.4285714286
18571.4285714286
       
0.0185714285714286
0.0185714285714286
       
0.0000185714285714286
0.0000185714285714286
       
1.85714285714286e-35
1.85714285714286e-35

Značajnim znamenkama broja x0 u zapisu sa zarezom nazivaju se prva znamenka slijeva različita od nule i sve znamenke desno od nje do kraja zapisa; za x=0 sve su znamenke u zapisu značajne.

       
0.000000000000000
0.000000000000000

 

Prikaz s pomičnim (plivajućim) zarezom (u engleskom: s plivajućom točkom — floating point)

 

dekadski sustav:  x=±m10e

    m — normalizirana mantisa,  1m<10  ili  m=0

    e — eksponent

          123456780000000000000,0=1,23456781020

          123,45678=1,2345678102

          0,00012345678=1,2345678104

          0,000000000000000000012345678=1,23456781020

          normalizacija omogućava zapis najvećeg broja značajnih znamenaka ako je broj znamenaka u prikazu broja ograničen

 

binarni sustav (najjednostavnije):  x=sm2e

    s{1,1}

    1m<2  ili  m=0 

          ako je  m[1,2),  prva je znamenka u binarnom prikazu uvijek 1    skriveni bit

 

binarni sustav (u GNU MPFR-u i SageMath-u (RealField())):  x=sm2ep

    p — točnost (broj bitova mantise)

    2p1m<2p  ili  m=0

    2B+1e2B1

          (B=30 na 32-bitnim računalima, B=62 na 64-bitnim računalima)

 [GNU MPFR — GNU Multiple Precision Floating-Point Reliable Library; GNU (GNU's Not Unix!)  — an extensive collection of free software

       
-1.00000000000000
-1.00000000000000
       
(-1, 4503599627370496, -52, 1/4503599627370496)
(-1, 4503599627370496, -52, 1/4503599627370496)
       
-1
-1
       
0.333333333333333
0.333333333333333
       
(1, 6004799503160661, -54, 1/18014398509481984)
(1, 6004799503160661, -54, 1/18014398509481984)
       
600479950316066118014398509481984

                                
       
600479950316066118014398509481984

                                
       
0.100000000000000
0.100000000000000
       
(1, 7205759403792794, -56, 1/72057594037927936)
(1, 7205759403792794, -56, 1/72057594037927936)
       
360287970189639736028797018963968

                                
       
360287970189639736028797018963968

                                
       
-1.0000000000000000000000
-1.0000000000000000000000
       
Real Field with 80 bits of precision
Real Field with 80 bits of precision
       
(-1, 604462909807314587353088, -79, 1/604462909807314587353088)
(-1, 604462909807314587353088, -79, 1/604462909807314587353088)
       
-1
-1
       
-0.33333333333333333333333
-0.33333333333333333333333
       
(-1, 805950546409752783137451, -81, 1/2417851639229258349412352)
(-1, 805950546409752783137451, -81, 1/2417851639229258349412352)
       
8059505464097527831374512417851639229258349412352

                                
       
8059505464097527831374512417851639229258349412352

                                
       
(-0.33333333333333333333333, Real Field with 80 bits of precision)
(-0.33333333333333333333333, Real Field with 80 bits of precision)
       
(-0.333333333333333, Real Field with 53 bits of precision)
(-0.333333333333333, Real Field with 53 bits of precision)


točnost (precision) prikaza s pomičnim zarezom ovisi o broju bitova mantise (binarnih značajnih znamenaka)

veza između broja značajnih znamenaka u binarnom i u dekadskom zapisu:

  • ako je u binarnom sustavu mantisa broja zapisana s b bitova (binarnih znamenaka), onda će u dekadskom sustavu broj imati približno  blog102  značajnih znamenaka
  • za zapis d dekadskih značajnih znamenaka potrebno je približno  dlog210 bitova
       
9007199254740991
9007199254740992
9007199254740991
9007199254740992
       
9999999999999999
10000000000000000
9999999999999999
10000000000000000
       
9007199254740992
10000000000000000
9007199254740992
10000000000000000
       
15.9545897701910
15.9545897701910
       
53.1508495181978
53.1508495181978
       
       
16
16
       
53
53
       
24
24
       
80
80
  • SageMath je pri ispisu brojeva na „(ne)sigurnoj strani”:
       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
       
1.3333333333333333
1.33333333333333
1.3333333333333333
1.33333333333333
       
15
15
       
7
7
       
2.71828182845905
2.718282
2.71828182845905
2.718282
       
2.71828
2.71828
       
Traceback (click to the left of this block for traceback)
...
TypeError: cannot approximate to a precision of 27 bits, use at most 24 bits
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_6.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("TiAoZWUsIGRpZ2l0cyA9IDcp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpqkbP9v/___code___.py", line 3, in <module>
    exec compile(u'N (ee, digits = _sage_const_7 )
  File "", line 1, in <module>
    
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/misc/functional.py", line 1419, in numerical_approx
    return n(prec, algorithm=algorithm)
  File "sage/structure/element.pyx", line 850, in sage.structure.element.Element.numerical_approx (build/cythonized/sage/structure/element.c:7829)
  File "sage/arith/numerical_approx.pyx", line 65, in sage.arith.numerical_approx.numerical_approx_generic (build/cythonized/sage/arith/numerical_approx.c:2666)
TypeError: cannot approximate to a precision of 27 bits, use at most 24 bits
       
2.718282
2.718282
       
Real Field with 47 bits of precision
Real Field with 47 bits of precision


strojna točnost (machine epsilon)  —  najmanji pozitivni broj ϵm koji pribrojen broju 1 daje broj različit od 1:   1+ϵm1

       najmanji broj veći od 1:   ˉx=(1,000001)2=1+2(p1)=1+ϵmϵm=2(p1)

       
Real Field with 53 bits of precision
Real Field with 53 bits of precision
       
1/4503599627370496
1/4503599627370496
       
False
False
       
True
True
       
2.22044604925031e-16
2.22044604925031e-16
       
1.11022302462516e-16
1.11022302462516e-16
       
       
0 :  1.00000000000000
1 :  0.500000000000000
2 :  0.250000000000000
3 :  0.125000000000000
4 :  0.0625000000000000
5 :  0.0312500000000000
6 :  0.0156250000000000
7 :  0.00781250000000000
8 :  0.00390625000000000
9 :  0.00195312500000000
10 :  0.000976562500000000
11 :  0.000488281250000000
12 :  0.000244140625000000
13 :  0.000122070312500000
14 :  0.0000610351562500000
15 :  0.0000305175781250000
16 :  0.0000152587890625000
17 :  7.62939453125000e-6
18 :  3.81469726562500e-6
19 :  1.90734863281250e-6
20 :  9.53674316406250e-7
21 :  4.76837158203125e-7
22 :  2.38418579101562e-7
23 :  1.19209289550781e-7
24 :  5.96046447753906e-8
25 :  2.98023223876953e-8
26 :  1.49011611938477e-8
27 :  7.45058059692383e-9
28 :  3.72529029846191e-9
29 :  1.86264514923096e-9
30 :  9.31322574615479e-10
31 :  4.65661287307739e-10
32 :  2.32830643653870e-10
33 :  1.16415321826935e-10
34 :  5.82076609134674e-11
35 :  2.91038304567337e-11
36 :  1.45519152283669e-11
37 :  7.27595761418343e-12
38 :  3.63797880709171e-12
39 :  1.81898940354586e-12
40 :  9.09494701772928e-13
41 :  4.54747350886464e-13
42 :  2.27373675443232e-13
43 :  1.13686837721616e-13
44 :  5.68434188608080e-14
45 :  2.84217094304040e-14
46 :  1.42108547152020e-14
47 :  7.10542735760100e-15
48 :  3.55271367880050e-15
49 :  1.77635683940025e-15
50 :  8.88178419700125e-16
51 :  4.44089209850063e-16
52 :  2.22044604925031e-16
2.22044604925031e-16
0 :  1.00000000000000
1 :  0.500000000000000
2 :  0.250000000000000
3 :  0.125000000000000
4 :  0.0625000000000000
5 :  0.0312500000000000
6 :  0.0156250000000000
7 :  0.00781250000000000
8 :  0.00390625000000000
9 :  0.00195312500000000
10 :  0.000976562500000000
11 :  0.000488281250000000
12 :  0.000244140625000000
13 :  0.000122070312500000
14 :  0.0000610351562500000
15 :  0.0000305175781250000
16 :  0.0000152587890625000
17 :  7.62939453125000e-6
18 :  3.81469726562500e-6
19 :  1.90734863281250e-6
20 :  9.53674316406250e-7
21 :  4.76837158203125e-7
22 :  2.38418579101562e-7
23 :  1.19209289550781e-7
24 :  5.96046447753906e-8
25 :  2.98023223876953e-8
26 :  1.49011611938477e-8
27 :  7.45058059692383e-9
28 :  3.72529029846191e-9
29 :  1.86264514923096e-9
30 :  9.31322574615479e-10
31 :  4.65661287307739e-10
32 :  2.32830643653870e-10
33 :  1.16415321826935e-10
34 :  5.82076609134674e-11
35 :  2.91038304567337e-11
36 :  1.45519152283669e-11
37 :  7.27595761418343e-12
38 :  3.63797880709171e-12
39 :  1.81898940354586e-12
40 :  9.09494701772928e-13
41 :  4.54747350886464e-13
42 :  2.27373675443232e-13
43 :  1.13686837721616e-13
44 :  5.68434188608080e-14
45 :  2.84217094304040e-14
46 :  1.42108547152020e-14
47 :  7.10542735760100e-15
48 :  3.55271367880050e-15
49 :  1.77635683940025e-15
50 :  8.88178419700125e-16
51 :  4.44089209850063e-16
52 :  2.22044604925031e-16
2.22044604925031e-16
       
0 :  1.00
1 :  0.500
2 :  0.250
3 :  0.125
4 :  0.0625
5 :  0.0312
6 :  0.0156
7 :  0.00781
8 :  0.00391
9 :  0.00195
10 :  0.000977
11 :  0.000488
12 :  0.000244
13 :  0.000122
0.000122
0 :  1.00
1 :  0.500
2 :  0.250
3 :  0.125
4 :  0.0625
5 :  0.0312
6 :  0.0156
7 :  0.00781
8 :  0.00391
9 :  0.00195
10 :  0.000977
11 :  0.000488
12 :  0.000244
13 :  0.000122
0.000122
       
1.6543612251060553497428e-24
1.6543612251060553497428e-24
       
1/604462909807314587353088
1/604462909807314587353088
       
1.6543612251060553497428e-24
1.6543612251060553497428e-24


jedinica na posljednjem mjestu (unit in the last place, ULP) — za (prikazivi) broj x>0, razmak između x i prvoga prikazivog većeg broja

       
2.22044604925031e-16
2.22044604925031e-16
       
1.77635683940025e-15
1.77635683940025e-15
       
1.42108547152020e-14
1.42108547152020e-14
       
False
False
       
True
True
       
False
False
       
True
True
       
True
True
       
True
True
       
False
False
       
True
True
       
False
False
  • ULP za brojeve  2ib,2ib+1,...,2ie1:
       
       
-10  :  0.000976562500000000  :  2.16840434497101e-19
-9  :  0.00195312500000000  :  4.33680868994202e-19
-8  :  0.00390625000000000  :  8.67361737988404e-19
-7  :  0.00781250000000000  :  1.73472347597681e-18
-6  :  0.0156250000000000  :  3.46944695195361e-18
-5  :  0.0312500000000000  :  6.93889390390723e-18
-4  :  0.0625000000000000  :  1.38777878078145e-17
-3  :  0.125000000000000  :  2.77555756156289e-17
-2  :  0.250000000000000  :  5.55111512312578e-17
-1  :  0.500000000000000  :  1.11022302462516e-16
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  2.00000000000000  :  4.44089209850063e-16
2  :  4.00000000000000  :  8.88178419700125e-16
3  :  8.00000000000000  :  1.77635683940025e-15
4  :  16.0000000000000  :  3.55271367880050e-15
5  :  32.0000000000000  :  7.10542735760100e-15
6  :  64.0000000000000  :  1.42108547152020e-14
7  :  128.000000000000  :  2.84217094304040e-14
8  :  256.000000000000  :  5.68434188608080e-14
9  :  512.000000000000  :  1.13686837721616e-13
10  :  1024.00000000000  :  2.27373675443232e-13
-10  :  0.000976562500000000  :  2.16840434497101e-19
-9  :  0.00195312500000000  :  4.33680868994202e-19
-8  :  0.00390625000000000  :  8.67361737988404e-19
-7  :  0.00781250000000000  :  1.73472347597681e-18
-6  :  0.0156250000000000  :  3.46944695195361e-18
-5  :  0.0312500000000000  :  6.93889390390723e-18
-4  :  0.0625000000000000  :  1.38777878078145e-17
-3  :  0.125000000000000  :  2.77555756156289e-17
-2  :  0.250000000000000  :  5.55111512312578e-17
-1  :  0.500000000000000  :  1.11022302462516e-16
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  2.00000000000000  :  4.44089209850063e-16
2  :  4.00000000000000  :  8.88178419700125e-16
3  :  8.00000000000000  :  1.77635683940025e-15
4  :  16.0000000000000  :  3.55271367880050e-15
5  :  32.0000000000000  :  7.10542735760100e-15
6  :  64.0000000000000  :  1.42108547152020e-14
7  :  128.000000000000  :  2.84217094304040e-14
8  :  256.000000000000  :  5.68434188608080e-14
9  :  512.000000000000  :  1.13686837721616e-13
10  :  1024.00000000000  :  2.27373675443232e-13
    • ako je  x=2k,  onda je  ulp(x)=ϵm2k
       
-10  :  0.00097656250000000000000000  :  1.6155871338926321774832e-27
-9  :  0.0019531250000000000000000  :  3.2311742677852643549664e-27
-8  :  0.0039062500000000000000000  :  6.4623485355705287099329e-27
-7  :  0.0078125000000000000000000  :  1.2924697071141057419866e-26
-6  :  0.015625000000000000000000  :  2.5849394142282114839732e-26
-5  :  0.031250000000000000000000  :  5.1698788284564229679463e-26
-4  :  0.062500000000000000000000  :  1.0339757656912845935893e-25
-3  :  0.12500000000000000000000  :  2.0679515313825691871785e-25
-2  :  0.25000000000000000000000  :  4.1359030627651383743570e-25
-1  :  0.50000000000000000000000  :  8.2718061255302767487141e-25
0  :  1.0000000000000000000000  :  1.6543612251060553497428e-24
1  :  2.0000000000000000000000  :  3.3087224502121106994856e-24
2  :  4.0000000000000000000000  :  6.6174449004242213989713e-24
3  :  8.0000000000000000000000  :  1.3234889800848442797943e-23
4  :  16.000000000000000000000  :  2.6469779601696885595885e-23
5  :  32.000000000000000000000  :  5.2939559203393771191770e-23
6  :  64.000000000000000000000  :  1.0587911840678754238354e-22
7  :  128.00000000000000000000  :  2.1175823681357508476708e-22
8  :  256.00000000000000000000  :  4.2351647362715016953416e-22
9  :  512.00000000000000000000  :  8.4703294725430033906832e-22
10  :  1024.0000000000000000000  :  1.6940658945086006781366e-21
-10  :  0.00097656250000000000000000  :  1.6155871338926321774832e-27
-9  :  0.0019531250000000000000000  :  3.2311742677852643549664e-27
-8  :  0.0039062500000000000000000  :  6.4623485355705287099329e-27
-7  :  0.0078125000000000000000000  :  1.2924697071141057419866e-26
-6  :  0.015625000000000000000000  :  2.5849394142282114839732e-26
-5  :  0.031250000000000000000000  :  5.1698788284564229679463e-26
-4  :  0.062500000000000000000000  :  1.0339757656912845935893e-25
-3  :  0.12500000000000000000000  :  2.0679515313825691871785e-25
-2  :  0.25000000000000000000000  :  4.1359030627651383743570e-25
-1  :  0.50000000000000000000000  :  8.2718061255302767487141e-25
0  :  1.0000000000000000000000  :  1.6543612251060553497428e-24
1  :  2.0000000000000000000000  :  3.3087224502121106994856e-24
2  :  4.0000000000000000000000  :  6.6174449004242213989713e-24
3  :  8.0000000000000000000000  :  1.3234889800848442797943e-23
4  :  16.000000000000000000000  :  2.6469779601696885595885e-23
5  :  32.000000000000000000000  :  5.2939559203393771191770e-23
6  :  64.000000000000000000000  :  1.0587911840678754238354e-22
7  :  128.00000000000000000000  :  2.1175823681357508476708e-22
8  :  256.00000000000000000000  :  4.2351647362715016953416e-22
9  :  512.00000000000000000000  :  8.4703294725430033906832e-22
10  :  1024.0000000000000000000  :  1.6940658945086006781366e-21
       
70  :  1.1805916207174113034240e21  :  0.0019531250000000000000000
71  :  2.3611832414348226068480e21  :  0.0039062500000000000000000
72  :  4.7223664828696452136960e21  :  0.0078125000000000000000000
73  :  9.4447329657392904273920e21  :  0.015625000000000000000000
74  :  1.8889465931478580854784e22  :  0.031250000000000000000000
75  :  3.7778931862957161709568e22  :  0.062500000000000000000000
76  :  7.5557863725914323419136e22  :  0.12500000000000000000000
77  :  1.5111572745182864683827e23  :  0.25000000000000000000000
78  :  3.0223145490365729367654e23  :  0.50000000000000000000000
79  :  6.0446290980731458735309e23  :  1.0000000000000000000000
80  :  1.2089258196146291747062e24  :  2.0000000000000000000000
70  :  1.1805916207174113034240e21  :  0.0019531250000000000000000
71  :  2.3611832414348226068480e21  :  0.0039062500000000000000000
72  :  4.7223664828696452136960e21  :  0.0078125000000000000000000
73  :  9.4447329657392904273920e21  :  0.015625000000000000000000
74  :  1.8889465931478580854784e22  :  0.031250000000000000000000
75  :  3.7778931862957161709568e22  :  0.062500000000000000000000
76  :  7.5557863725914323419136e22  :  0.12500000000000000000000
77  :  1.5111572745182864683827e23  :  0.25000000000000000000000
78  :  3.0223145490365729367654e23  :  0.50000000000000000000000
79  :  6.0446290980731458735309e23  :  1.0000000000000000000000
80  :  1.2089258196146291747062e24  :  2.0000000000000000000000
       
50  :  1.12589990684262e15  :  0.250000000000000
51  :  2.25179981368525e15  :  0.500000000000000
52  :  4.50359962737050e15  :  1.00000000000000
53  :  9.00719925474099e15  :  2.00000000000000
54  :  1.80143985094820e16  :  4.00000000000000
55  :  3.60287970189640e16  :  8.00000000000000
56  :  7.20575940379279e16  :  16.0000000000000
57  :  1.44115188075856e17  :  32.0000000000000
58  :  2.88230376151712e17  :  64.0000000000000
59  :  5.76460752303423e17  :  128.000000000000
60  :  1.15292150460685e18  :  256.000000000000
61  :  2.30584300921369e18  :  512.000000000000
62  :  4.61168601842739e18  :  1024.00000000000
63  :  9.22337203685478e18  :  2048.00000000000
64  :  1.84467440737096e19  :  4096.00000000000
65  :  3.68934881474191e19  :  8192.00000000000
66  :  7.37869762948382e19  :  16384.0000000000
67  :  1.47573952589676e20  :  32768.0000000000
68  :  2.95147905179353e20  :  65536.0000000000
69  :  5.90295810358706e20  :  131072.000000000
70  :  1.18059162071741e21  :  262144.000000000
50  :  1.12589990684262e15  :  0.250000000000000
51  :  2.25179981368525e15  :  0.500000000000000
52  :  4.50359962737050e15  :  1.00000000000000
53  :  9.00719925474099e15  :  2.00000000000000
54  :  1.80143985094820e16  :  4.00000000000000
55  :  3.60287970189640e16  :  8.00000000000000
56  :  7.20575940379279e16  :  16.0000000000000
57  :  1.44115188075856e17  :  32.0000000000000
58  :  2.88230376151712e17  :  64.0000000000000
59  :  5.76460752303423e17  :  128.000000000000
60  :  1.15292150460685e18  :  256.000000000000
61  :  2.30584300921369e18  :  512.000000000000
62  :  4.61168601842739e18  :  1024.00000000000
63  :  9.22337203685478e18  :  2048.00000000000
64  :  1.84467440737096e19  :  4096.00000000000
65  :  3.68934881474191e19  :  8192.00000000000
66  :  7.37869762948382e19  :  16384.0000000000
67  :  1.47573952589676e20  :  32768.0000000000
68  :  2.95147905179353e20  :  65536.0000000000
69  :  5.90295810358706e20  :  131072.000000000
70  :  1.18059162071741e21  :  262144.000000000
       
0  :  1.00  :  0.000122
1  :  2.00  :  0.000244
2  :  4.00  :  0.000488
3  :  8.00  :  0.000977
4  :  16.0  :  0.00195
5  :  32.0  :  0.00391
6  :  64.0  :  0.00781
7  :  128.  :  0.0156
8  :  256.  :  0.0312
9  :  512.  :  0.0625
10  :  1020.  :  0.125
0  :  1.00  :  0.000122
1  :  2.00  :  0.000244
2  :  4.00  :  0.000488
3  :  8.00  :  0.000977
4  :  16.0  :  0.00195
5  :  32.0  :  0.00391
6  :  64.0  :  0.00781
7  :  128.  :  0.0156
8  :  256.  :  0.0312
9  :  512.  :  0.0625
10  :  1020.  :  0.125
  • ULP za brojeve  x,x+dx,x+2dx,...,x+(n1)dx:
       
       
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  1.10000000000000  :  2.22044604925031e-16
2  :  1.20000000000000  :  2.22044604925031e-16
3  :  1.30000000000000  :  2.22044604925031e-16
4  :  1.40000000000000  :  2.22044604925031e-16
5  :  1.50000000000000  :  2.22044604925031e-16
6  :  1.60000000000000  :  2.22044604925031e-16
7  :  1.70000000000000  :  2.22044604925031e-16
8  :  1.80000000000000  :  2.22044604925031e-16
9  :  1.90000000000000  :  2.22044604925031e-16
10  :  2.00000000000000  :  4.44089209850063e-16
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  1.10000000000000  :  2.22044604925031e-16
2  :  1.20000000000000  :  2.22044604925031e-16
3  :  1.30000000000000  :  2.22044604925031e-16
4  :  1.40000000000000  :  2.22044604925031e-16
5  :  1.50000000000000  :  2.22044604925031e-16
6  :  1.60000000000000  :  2.22044604925031e-16
7  :  1.70000000000000  :  2.22044604925031e-16
8  :  1.80000000000000  :  2.22044604925031e-16
9  :  1.90000000000000  :  2.22044604925031e-16
10  :  2.00000000000000  :  4.44089209850063e-16
       
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  2.00000000000000  :  4.44089209850063e-16
2  :  3.00000000000000  :  4.44089209850063e-16
3  :  4.00000000000000  :  8.88178419700125e-16
4  :  5.00000000000000  :  8.88178419700125e-16
5  :  6.00000000000000  :  8.88178419700125e-16
6  :  7.00000000000000  :  8.88178419700125e-16
7  :  8.00000000000000  :  1.77635683940025e-15
8  :  9.00000000000000  :  1.77635683940025e-15
9  :  10.0000000000000  :  1.77635683940025e-15
10  :  11.0000000000000  :  1.77635683940025e-15
11  :  12.0000000000000  :  1.77635683940025e-15
12  :  13.0000000000000  :  1.77635683940025e-15
13  :  14.0000000000000  :  1.77635683940025e-15
14  :  15.0000000000000  :  1.77635683940025e-15
0  :  1.00000000000000  :  2.22044604925031e-16
1  :  2.00000000000000  :  4.44089209850063e-16
2  :  3.00000000000000  :  4.44089209850063e-16
3  :  4.00000000000000  :  8.88178419700125e-16
4  :  5.00000000000000  :  8.88178419700125e-16
5  :  6.00000000000000  :  8.88178419700125e-16
6  :  7.00000000000000  :  8.88178419700125e-16
7  :  8.00000000000000  :  1.77635683940025e-15
8  :  9.00000000000000  :  1.77635683940025e-15
9  :  10.0000000000000  :  1.77635683940025e-15
10  :  11.0000000000000  :  1.77635683940025e-15
11  :  12.0000000000000  :  1.77635683940025e-15
12  :  13.0000000000000  :  1.77635683940025e-15
13  :  14.0000000000000  :  1.77635683940025e-15
14  :  15.0000000000000  :  1.77635683940025e-15
    • ako je  x=m2k,  gdje je m normalizirana mantisa, onda je  ulp(x)=ϵm2k
       
0  :  2.0000000000000000000000  :  3.3087224502121106994856e-24
1  :  2.1000000000000000000000  :  3.3087224502121106994856e-24
2  :  2.2000000000000000000000  :  3.3087224502121106994856e-24
3  :  2.3000000000000000000000  :  3.3087224502121106994856e-24
4  :  2.4000000000000000000000  :  3.3087224502121106994856e-24
5  :  2.5000000000000000000000  :  3.3087224502121106994856e-24
6  :  2.6000000000000000000000  :  3.3087224502121106994856e-24
7  :  2.7000000000000000000000  :  3.3087224502121106994856e-24
8  :  2.8000000000000000000000  :  3.3087224502121106994856e-24
9  :  2.9000000000000000000000  :  3.3087224502121106994856e-24
10  :  3.0000000000000000000000  :  3.3087224502121106994856e-24
11  :  3.1000000000000000000000  :  3.3087224502121106994856e-24
12  :  3.2000000000000000000000  :  3.3087224502121106994856e-24
13  :  3.3000000000000000000000  :  3.3087224502121106994856e-24
14  :  3.4000000000000000000000  :  3.3087224502121106994856e-24
15  :  3.5000000000000000000000  :  3.3087224502121106994856e-24
16  :  3.6000000000000000000000  :  3.3087224502121106994856e-24
17  :  3.7000000000000000000000  :  3.3087224502121106994856e-24
18  :  3.8000000000000000000000  :  3.3087224502121106994856e-24
19  :  3.9000000000000000000000  :  3.3087224502121106994856e-24
20  :  4.0000000000000000000000  :  3.3087224502121106994856e-24
21  :  4.1000000000000000000000  :  6.6174449004242213989713e-24
0  :  2.0000000000000000000000  :  3.3087224502121106994856e-24
1  :  2.1000000000000000000000  :  3.3087224502121106994856e-24
2  :  2.2000000000000000000000  :  3.3087224502121106994856e-24
3  :  2.3000000000000000000000  :  3.3087224502121106994856e-24
4  :  2.4000000000000000000000  :  3.3087224502121106994856e-24
5  :  2.5000000000000000000000  :  3.3087224502121106994856e-24
6  :  2.6000000000000000000000  :  3.3087224502121106994856e-24
7  :  2.7000000000000000000000  :  3.3087224502121106994856e-24
8  :  2.8000000000000000000000  :  3.3087224502121106994856e-24
9  :  2.9000000000000000000000  :  3.3087224502121106994856e-24
10  :  3.0000000000000000000000  :  3.3087224502121106994856e-24
11  :  3.1000000000000000000000  :  3.3087224502121106994856e-24
12  :  3.2000000000000000000000  :  3.3087224502121106994856e-24
13  :  3.3000000000000000000000  :  3.3087224502121106994856e-24
14  :  3.4000000000000000000000  :  3.3087224502121106994856e-24
15  :  3.5000000000000000000000  :  3.3087224502121106994856e-24
16  :  3.6000000000000000000000  :  3.3087224502121106994856e-24
17  :  3.7000000000000000000000  :  3.3087224502121106994856e-24
18  :  3.8000000000000000000000  :  3.3087224502121106994856e-24
19  :  3.9000000000000000000000  :  3.3087224502121106994856e-24
20  :  4.0000000000000000000000  :  3.3087224502121106994856e-24
21  :  4.1000000000000000000000  :  6.6174449004242213989713e-24

 

zbrajanje „realnih” brojeva nije asocijativno:

       
       
False
False
       
False
False
       
1.00000000000000
1.0000000000000002
1.00000000000000
1.0000000000000002
       
True
True
       
1.00000000000000
1.0000000000000000
1.00000000000000
1.0000000000000000
       
True
1.00000000000000
True
1.00000000000000
       
False
1.00000000000000
False
1.00000000000000

 

zbrajanje brojeva tipa  RealField(14)

 

3+2=(11000000000000)2×212+(10000000000000)2×212:

 

+(111000000000000)2×212

+(110000000000000)2×212

=(101000000000000)2×212

=(110100000000000)2×211        normalizacija

 

 3+34=(11000000000000)2×212+(11000000000000)2×214:

 

+(11000000000000)2×212

+(00110000000000)2×212        pomicanje mantise 12(14)=2 mjesta udesno

=(11110000000000)2×212

 

1+12ulp(1)=(10000000000000)2×213+(10000000000000)2×227:

 

+(10000000000000|1)2×213

+(00000000000000|1)2×213        pomicanje mantise 13(27)=14 mjesta udesno

=(10000000000000|1)2×213

(10000000000000|1)2×213

 

12ulp(1)+12ulp(1)=(10000000000000)2×227+(10000000000000)2×227:

 

+(110000000000000)2×227

+(110000000000000)2×227

=(100000000000000)2×227

=(110000000000000)2×226      

 

1+ulp(1)=(10000000000000)2×213+(10000000000000)2×226:

 

+(11000000000000)2×213

+(00000000000001)2×213        pomicanje mantise 13(26)=13 mjesta udesno

=(10000000000001)2×213 

   

 
 
zaokruživanja (roundingRND)
  • prema najbližem, to nearestN  (podrazumijeva se):
       
(0.333, 0.667, -0.333, -0.667)
(0.333, 0.667, -0.333, -0.667)
  • naniže (prema ), down, D:
       
(0.333, 0.666, -0.334, -0.667)
(0.333, 0.666, -0.334, -0.667)
  • naviše (prema +), up, U:
       
(0.334, 0.667, -0.333, -0.666)
(0.334, 0.667, -0.333, -0.666)
  • prema nuli, towards zero, Z
       
(0.333, 0.666, -0.333, -0.666)
(0.333, 0.666, -0.333, -0.666)
  • od nule, away from zero, A
       
(0.334, 0.667, -0.334, -0.667)
(0.334, 0.667, -0.334, -0.667)

 

zbrajanja i zaokruživanja:

       
(True, True)
(True, True)
       
(True, False)
(True, False)
       
(False, True)
(False, True)
       
(True, True)
(True, True)
       
(False, False)
(False, False)

 

(apsolutna) greška zaokruživanja:

  • |ˉxx|<ulp(ˉx)  za D, U, Z, A
  • |ˉxx|<12ulp(ˉx)  za N

 

„intervalna” aritmetika:

       
(3.14159265358979, 2.71828182845904, 0.650623412682596)
(3.14159265358979, 2.71828182845904, 0.650623412682596)
       
(3.14159265358980, 2.71828182845905, 0.650623412682597)
(3.14159265358980, 2.71828182845905, 0.650623412682597)

... realni broj πr leži u intervalu između „realnih” brojeva sd i su

 

ispitivanje jednakosti „realnih” brojeva

       
1.00000000000000
1.00000000000000
       
False
False
       
^C
Traceback (click to the left of this block for traceback)
...
__SAGE__
^C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_3.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cyA9IDAuCndoaWxlIChzICE9IDEuKSA6CiAgICBzICs9IDAuMQpz"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpQnoHQZ/___code___.py", line 5, in <module>
    s += _sage_const_0p1 
  File "src/cysignals/signals.pyx", line 320, in cysignals.signals.python_check_interrupt
KeyboardInterrupt
__SAGE__
       
2.64211950131177e6
2.64211950131177e6
       
'0.10000000000000001'
'0.20000000000000001'
'0.30000000000000004'
'0.40000000000000002'
'0.50000000000000000'
'0.59999999999999998'
'0.69999999999999996'
'0.79999999999999993'
'0.89999999999999991'
'0.99999999999999989'
'1.0999999999999999'
'1.2000000000000000'
'0.10000000000000001'
'0.20000000000000001'
'0.30000000000000004'
'0.40000000000000002'
'0.50000000000000000'
'0.59999999999999998'
'0.69999999999999996'
'0.79999999999999993'
'0.89999999999999991'
'0.99999999999999989'
'1.0999999999999999'
'1.2000000000000000'
  •  110=0,1=(0,00011001100110011)2=(0,0¯0011)2
       
0.100000000000000 

0.100000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0.100000000000000 

0.10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
       
0.00011001100110011001100110011001100110011001100110011010 

0.000110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011001100110011001100110011001100110\
01100110011001100110011001100110011001100110011010
0.00011001100110011001100110011001100110011001100110011010 

0.00011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010
       
0.10000000000000001 

0.100000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
01
0.10000000000000001 

0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
       
0.100000000000000005551115123125782702118158340454101562500000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0.10000000000000000555111512312578270211815834045410156250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
       
Traceback (click to the left of this block for traceback)
...
TypeError: cannot approximate to a precision of 1325 bits, use at most 53 bits
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_87.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("TiAoYTUzLCAxMzI1KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpqZQ98Y/___code___.py", line 3, in <module>
    exec compile(u'N (a53, _sage_const_1325 )
  File "", line 1, in <module>
    
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/misc/functional.py", line 1419, in numerical_approx
    return n(prec, algorithm=algorithm)
  File "sage/structure/element.pyx", line 850, in sage.structure.element.Element.numerical_approx (build/cythonized/sage/structure/element.c:7829)
  File "sage/arith/numerical_approx.pyx", line 65, in sage.arith.numerical_approx.numerical_approx_generic (build/cythonized/sage/arith/numerical_approx.c:2666)
TypeError: cannot approximate to a precision of 1325 bits, use at most 53 bits

   

       
(4.000000000000001.000000000000001.000000000000000.0000000000000000.0000000000000001.000000000000004.000000000000001.000000000000001.000000000000000.0000000000000001.000000000000001.000000000000004.000000000000001.000000000000001.000000000000000.0000000000000001.000000000000001.000000000000004.000000000000001.000000000000000.0000000000000000.0000000000000001.000000000000001.000000000000004.00000000000000)

                                
       
(0.3238866396761130.1417004048583000.1538461538461540.08906882591093120.06072874493927120.1417004048583000.3744939271255060.1923076923076920.1639676113360320.08906882591093120.1538461538461540.1923076923076920.4230769230769230.1923076923076920.1538461538461540.08906882591093120.1639676113360320.1923076923076920.3744939271255060.1417004048583000.06072874493927120.08906882591093120.1538461538461540.1417004048583000.323886639676113)

                                

za inverznu bi matricu trebalo vrijediti  AA1=A1A=I, ali...

       
False
False
       
False
False
       
False
False

... naime, kako „realna” aritmetika na računalu nije matematička realna aritmetika beskonačne točnosti, komponente matrice AA1 koje bi trebale biti nule, nisu nule:

       
(1.000000000000002.77555756156289×10170.0000000000000002.77555756156289×10172.77555756156289×10175.55111512312578×10171.000000000000001.11022302462516×10165.55111512312578×10170.0000000000000006.93889390390723×10188.32667268468867×10171.000000000000002.77555756156289×10170.0000000000000002.08166817117217×10178.32667268468867×10172.77555756156289×10171.000000000000000.0000000000000002.77555756156289×10170.0000000000000000.0000000000000001.11022302462516×10161.00000000000000)

                                

... štoviše, nisu ni sve „jedinice” jedinice, iako su ispisane kao jedinice:

       
1

4503599627370497/4503599627370496
1
9007199254740991/9007199254740992
9007199254740991/9007199254740992
4503599627370495/4503599627370496
1

4503599627370497/4503599627370496
1
9007199254740991/9007199254740992
9007199254740991/9007199254740992
4503599627370495/4503599627370496
       
1.0000000000000002
1.0000000000000000
0.99999999999999989
0.99999999999999989
0.99999999999999978
1.0000000000000002
1.0000000000000000
0.99999999999999989
0.99999999999999989
0.99999999999999978

neki (ali nikako svi) ispravni načini ispitivanja „jednakosti”:

       
1.49011611938477e-8
1.49011611938477e-8
       
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
       
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
       
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]

... ili, varijacija na temu: 

       
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
[1 1 1 1 1]
       
{(0, 0): 2.22044604925031e-16,
 (0, 1): -2.77555756156289e-17,
 (0, 2): 0.000000000000000,
 (0, 3): -2.77555756156289e-17,
 (0, 4): -2.77555756156289e-17,
 (1, 0): -5.55111512312578e-17,
 (1, 1): 0.000000000000000,
 (1, 2): -1.11022302462516e-16,
 (1, 3): -5.55111512312578e-17,
 (1, 4): 0.000000000000000,
 (2, 0): 6.93889390390723e-18,
 (2, 1): -8.32667268468867e-17,
 (2, 2): -1.11022302462516e-16,
 (2, 3): -2.77555756156289e-17,
 (2, 4): 0.000000000000000,
 (3, 0): -2.08166817117217e-17,
 (3, 1): 8.32667268468867e-17,
 (3, 2): 2.77555756156289e-17,
 (3, 3): -1.11022302462516e-16,
 (3, 4): 0.000000000000000,
 (4, 0): -2.77555756156289e-17,
 (4, 1): 0.000000000000000,
 (4, 2): 0.000000000000000,
 (4, 3): -1.11022302462516e-16,
 (4, 4): -2.22044604925031e-16}
{(0, 0): 2.22044604925031e-16,
 (0, 1): -2.77555756156289e-17,
 (0, 2): 0.000000000000000,
 (0, 3): -2.77555756156289e-17,
 (0, 4): -2.77555756156289e-17,
 (1, 0): -5.55111512312578e-17,
 (1, 1): 0.000000000000000,
 (1, 2): -1.11022302462516e-16,
 (1, 3): -5.55111512312578e-17,
 (1, 4): 0.000000000000000,
 (2, 0): 6.93889390390723e-18,
 (2, 1): -8.32667268468867e-17,
 (2, 2): -1.11022302462516e-16,
 (2, 3): -2.77555756156289e-17,
 (2, 4): 0.000000000000000,
 (3, 0): -2.08166817117217e-17,
 (3, 1): 8.32667268468867e-17,
 (3, 2): 2.77555756156289e-17,
 (3, 3): -1.11022302462516e-16,
 (3, 4): 0.000000000000000,
 (4, 0): -2.77555756156289e-17,
 (4, 1): 0.000000000000000,
 (4, 2): 0.000000000000000,
 (4, 3): -1.11022302462516e-16,
 (4, 4): -2.22044604925031e-16}
       
25
25
       
True
True
       
{}
{}
       
0
0
       
True
True

... ili: 

       
True
True
       
True
True

... ili, varijacije:

       
True
True
       
True
True
       
True
True

 

infinity & NaN (Not a Number)

       
+infinity
+infinity
       
Traceback (click to the left of this block for traceback)
...
ZeroDivisionError: rational division by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_112.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("MS8w"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmp3fMu04/___code___.py", line 3, in <module>
    exec compile(u'_sage_const_1 /_sage_const_0 
  File "", line 1, in <module>
    
  File "sage/rings/integer.pyx", line 2047, in sage.rings.integer.Integer.__div__ (build/cythonized/sage/rings/integer.c:14042)
ZeroDivisionError: rational division by zero
       
-infinity
-infinity
       
-infinity
-infinity
       
-Infinity
-Infinity
       
+Infinity
+Infinity
       

                                
       
The Infinity Ring
Real Field with 53 bits of precision
The Infinity Ring
Real Field with 53 bits of precision
       
Real Field with 53 bits of precision
Symbolic Ring
Real Field with 53 bits of precision
Symbolic Ring
       
True
True
       
True
True
       
+Infinity
+Infinity
       
+infinity
+infinity
       
+Infinity
+Infinity
       
+Infinity
+Infinity
       
+Infinity
+Infinity
       
+Infinity
+Infinity
       
+infinity
+infinity
       
Traceback (click to the left of this block for traceback)
...
TypeError: unsupported operand parent(s) for ^: 'The Infinity Ring' and 'The
Infinity Ring'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_129.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Ml5vbw=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpPRg_2E/___code___.py", line 3, in <module>
    exec compile(u'_sage_const_2 **oo
  File "", line 1, in <module>
    
  File "sage/rings/integer.pyx", line 2213, in sage.rings.integer.Integer.__pow__ (build/cythonized/sage/rings/integer.c:14884)
  File "sage/structure/coerce.pyx", line 1163, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:9859)
  File "sage/structure/element.pyx", line 2038, in sage.structure.element.Element.__pow__ (build/cythonized/sage/structure/element.c:14037)
  File "sage/structure/element.pyx", line 2079, in sage.structure.element.Element._pow_ (build/cythonized/sage/structure/element.c:14381)
TypeError: unsupported operand parent(s) for ^: 'The Infinity Ring' and 'The Infinity Ring'
       
+infinity
+infinity
       
NaN
NaN
       
Traceback (click to the left of this block for traceback)
...
sage.rings.infinity.SignError: cannot add infinity to minus infinity
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_132.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("b28gLSBvbw=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpHCRCdg/___code___.py", line 2, in <module>
    exec compile(u'oo - oo
  File "", line 1, in <module>
    
  File "sage/structure/element.pyx", line 1359, in sage.structure.element.Element.__sub__ (build/cythonized/sage/structure/element.c:11339)
  File "sage/structure/element.pyx", line 2371, in sage.structure.element.ModuleElement._sub_ (build/cythonized/sage/structure/element.c:15388)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/rings/infinity.py", line 429, in _sub_
    raise SignError("cannot add infinity to minus infinity")
sage.rings.infinity.SignError: cannot add infinity to minus infinity
       
NaN
NaN
       
NaN
NaN
       
Traceback (click to the left of this block for traceback)
...
sage.rings.infinity.SignError: cannot multiply infinity by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_135.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("MCAqIG9v"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpJKBbmc/___code___.py", line 3, in <module>
    exec compile(u'_sage_const_0  * oo
  File "", line 1, in <module>
    
  File "sage/rings/integer.pyx", line 1989, in sage.rings.integer.Integer.__mul__ (build/cythonized/sage/rings/integer.c:13725)
  File "sage/structure/coerce.pyx", line 1163, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:9859)
  File "sage/structure/element.pyx", line 1517, in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:11977)
  File "sage/structure/element.pyx", line 2548, in sage.structure.element.RingElement._mul_ (build/cythonized/sage/structure/element.c:17481)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/rings/infinity.py", line 1369, in _mul_
    raise SignError("cannot multiply infinity by zero")
sage.rings.infinity.SignError: cannot multiply infinity by zero
       
NaN
NaN
       
Traceback (click to the left of this block for traceback)
...
sage.rings.infinity.SignError: cannot multiply infinity by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_137.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("b28gLyBvbw=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmp8XKd5C/___code___.py", line 2, in <module>
    exec compile(u'oo / oo
  File "", line 1, in <module>
    
  File "sage/structure/element.pyx", line 1647, in sage.structure.element.Element.__div__ (build/cythonized/sage/structure/element.c:12537)
  File "sage/structure/element.pyx", line 2649, in sage.structure.element.RingElement._div_ (build/cythonized/sage/structure/element.c:18126)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/rings/infinity.py", line 481, in _div_
    return self * ~other
  File "sage/structure/element.pyx", line 1519, in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:12012)
  File "sage/structure/coerce.pyx", line 1163, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:9859)
  File "sage/structure/element.pyx", line 1517, in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:11977)
  File "sage/structure/element.pyx", line 2548, in sage.structure.element.RingElement._mul_ (build/cythonized/sage/structure/element.c:17481)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/rings/infinity.py", line 455, in _mul_
    raise SignError("cannot multiply infinity by zero")
sage.rings.infinity.SignError: cannot multiply infinity by zero
       
NaN
NaN
       
True
True
       
False
False
       
False
False
       
False
False
       
True
True
       
True
True
       
False
False
       
True
True
       
False
False
       
False
False
       
False
False
       
False
False

   

       
       
       
0 -8.99999999999999 -1.89188589083065
1 74.2610504415619 1.99848639858029
2 -49414.0501674566 -1.99999999651880
3 1.41943459326446e13 2.00000000000000
4 -infinity NaN
5 NaN NaN + NaN*I
6 NaN + NaN*I NaN + NaN*I
7 NaN + NaN*I NaN + NaN*I
8 NaN + NaN*I NaN + NaN*I
9 NaN + NaN*I NaN + NaN*I
NaN + NaN*I
0 -8.99999999999999 -1.89188589083065
1 74.2610504415619 1.99848639858029
2 -49414.0501674566 -1.99999999651880
3 1.41943459326446e13 2.00000000000000
4 -infinity NaN
5 NaN NaN + NaN*I
6 NaN + NaN*I NaN + NaN*I
7 NaN + NaN*I NaN + NaN*I
8 NaN + NaN*I NaN + NaN*I
9 NaN + NaN*I NaN + NaN*I
NaN + NaN*I
       
       
0 -8.99999999999999 -1.89188589083065
1 74.2610504415619 1.99848639858029
2 -49414.0501674566 -1.99999999651880
3 1.41943459326446e13 2.00000000000000
4 -infinity NaN
-infinity
0 -8.99999999999999 -1.89188589083065
1 74.2610504415619 1.99848639858029
2 -49414.0501674566 -1.99999999651880
3 1.41943459326446e13 2.00000000000000
4 -infinity NaN
-infinity

 

... i još dvije sitnice (ili pitanje dosljednosti): 

       
1.00000000000000*I
1.00000000000000*I
       
Traceback (click to the left of this block for traceback)
...
ValueError: negative number -1.00000000000000 does not have a square root in the
real field
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_150.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("c3FydCAoLTEuLCBleHRlbmQgPSBGYWxzZSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpXavP9e/___code___.py", line 3, in <module>
    exec compile(u'sqrt (-_sage_const_1p , extend = False)
  File "", line 1, in <module>
    
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/functions/other.py", line 870, in sqrt
    return x.sqrt(*args, **kwds)
  File "sage/rings/real_mpfr.pyx", line 4129, in sage.rings.real_mpfr.RealNumber.sqrt (build/cythonized/sage/rings/real_mpfr.c:26558)
ValueError: negative number -1.00000000000000 does not have a square root in the real field
       
3.14159265358979*I
3.14159265358979*I
       
Traceback (click to the left of this block for traceback)
...
TypeError: __call__() got an unexpected keyword argument 'extend'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_152.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bG9nICgxLiwgZXh0ZW5kID0gRmFsc2Up"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpPLp2_c/___code___.py", line 3, in <module>
    exec compile(u'log (_sage_const_1p , extend = False)
  File "", line 1, in <module>
    
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/functions/log.py", line 436, in log
    return ln(args[0], **kwds)
  File "sage/symbolic/function.pyx", line 897, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:10405)
TypeError: __call__() got an unexpected keyword argument 'extend'