Introduction to Computer Science

Podobne dokumenty
Wst p do informatyki. Systemy liczbowe. Piotr Fulma«ski. 21 pa¹dziernika Wydziaª Matematyki i Informatyki, Uniwersytet Šódzki, Polska

Wst p do informatyki. Systemy liczbowe. Piotr Fulma«ski. November 9, Wydziaª Matematyki i Informatyki, Uniwersytet Šódzki, Polska

Informatyka, matematyka i sztuczki magiczne

Weronika Mysliwiec, klasa 8W, rok szkolny 2018/2019

Helena Boguta, klasa 8W, rok szkolny 2018/2019

Zakopane, plan miasta: Skala ok. 1: = City map (Polish Edition)

Tychy, plan miasta: Skala 1: (Polish Edition)

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Hard-Margin Support Vector Machines

SSW1.1, HFW Fry #20, Zeno #25 Benchmark: Qtr.1. Fry #65, Zeno #67. like

MaPlan Sp. z O.O. Click here if your download doesn"t start automatically

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

First-order logic. Usage. Tautologies, using rst-order logic, relations to natural language

Zarządzanie sieciami telekomunikacyjnymi

Machine Learning for Data Science (CS4786) Lecture11. Random Projections & Canonical Correlation Analysis

ARNOLD. EDUKACJA KULTURYSTY (POLSKA WERSJA JEZYKOWA) BY DOUGLAS KENT HALL

Revenue Maximization. Sept. 25, 2018

ERASMUS + : Trail of extinct and active volcanoes, earthquakes through Europe. SURVEY TO STUDENTS.

Patients price acceptance SELECTED FINDINGS

DODATKOWE ĆWICZENIA EGZAMINACYJNE

Ankiety Nowe funkcje! Pomoc Twoje konto Wyloguj. BIODIVERSITY OF RIVERS: Survey to students

Jak zasada Pareto może pomóc Ci w nauce języków obcych?

OpenPoland.net API Documentation

deep learning for NLP (5 lectures)

Egzamin maturalny z języka angielskiego na poziomie dwujęzycznym Rozmowa wstępna (wyłącznie dla egzaminującego)

Machine Learning for Data Science (CS4786) Lecture 11. Spectral Embedding + Clustering

Previously on CSCI 4622


Katowice, plan miasta: Skala 1: = City map = Stadtplan (Polish Edition)

EXAMPLES OF CABRI GEOMETRE II APPLICATION IN GEOMETRIC SCIENTIFIC RESEARCH

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

POLITYKA PRYWATNOŚCI / PRIVACY POLICY

TTIC 31210: Advanced Natural Language Processing. Kevin Gimpel Spring Lecture 8: Structured PredicCon 2

Emilka szuka swojej gwiazdy / Emily Climbs (Emily, #2)

TTIC 31210: Advanced Natural Language Processing. Kevin Gimpel Spring Lecture 9: Inference in Structured Prediction

Domy inaczej pomyślane A different type of housing CEZARY SANKOWSKI

Stargard Szczecinski i okolice (Polish Edition)

Rozpoznawanie twarzy metodą PCA Michał Bereta 1. Testowanie statystycznej istotności różnic między jakością klasyfikatorów

Polska Szkoła Weekendowa, Arklow, Co. Wicklow KWESTIONRIUSZ OSOBOWY DZIECKA CHILD RECORD FORM

Pielgrzymka do Ojczyzny: Przemowienia i homilie Ojca Swietego Jana Pawla II (Jan Pawel II-- pierwszy Polak na Stolicy Piotrowej) (Polish Edition)

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

ANKIETA ŚWIAT BAJEK MOJEGO DZIECKA


Konsorcjum Śląskich Uczelni Publicznych

DOI: / /32/37

Formularz dla osób planujących ubiegać się o przyjęcie na studia undergraduate (I stopnia) w USA na rok akademicki

Installation of EuroCert software for qualified electronic signature

Angielski Biznes Ciekawie

UMOWY WYPOŻYCZENIA KOMENTARZ

Dolny Slask 1: , mapa turystycznosamochodowa: Plan Wroclawia (Polish Edition)

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

Extraclass. Football Men. Season 2009/10 - Autumn round

GRY EDUKACYJNE I ICH MOŻLIWOŚCI DZIĘKI INTERNETOWI DZIŚ I JUTRO. Internet Rzeczy w wyobraźni gracza komputerowego

Steeple #3: Gödel s Silver Blaze Theorem. Selmer Bringsjord Are Humans Rational? Dec RPI Troy NY USA

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

Analysis of Movie Profitability STAT 469 IN CLASS ANALYSIS #2

Blow-Up: Photographs in the Time of Tumult; Black and White Photography Festival Zakopane Warszawa 2002 / Powiekszenie: Fotografie w czasach zgielku

Język angielski. Poziom rozszerzony Próbna Matura z OPERONEM i Gazetą Wyborczą CZĘŚĆ I KRYTERIA OCENIANIA ODPOWIEDZI POZIOM ROZSZERZONY CZĘŚĆ I

Ogólnopolski Próbny Egzamin Ósmoklasisty z OPERONEM. Język angielski Kartoteka testu. Wymagania szczegółowe Uczeń: Poprawna odpowiedź 1.1.

Pracownia Komputerowa wyk ad IV

EGZAMIN MATURALNY Z JĘZYKA ANGIELSKIEGO POZIOM ROZSZERZONY MAJ 2010 CZĘŚĆ I. Czas pracy: 120 minut. Liczba punktów do uzyskania: 23 WPISUJE ZDAJĄCY

EGZAMIN MATURALNY Z JĘZYKA ANGIELSKIEGO

Pracownia Komputerowa wykład IV

SubVersion. Piotr Mikulski. SubVersion. P. Mikulski. Co to jest subversion? Zalety SubVersion. Wady SubVersion. Inne różnice SubVersion i CVS

Baptist Church Records

Systemy liczbowe Plan zaję ć

ARYTMETYKA MODULARNA. Grzegorz Szkibiel. Wiosna 2014/15

Program doradczy EducationUSA - formularz zgłoszeniowy

INSTRUKCJA TWORZENIA KRZYśÓWEK

EGZAMIN MATURALNY Z JĘZYKA ANGIELSKIEGO

18. Przydatne zwroty podczas egzaminu ustnego. 19. Mo liwe pytania egzaminatora i przyk³adowe odpowiedzi egzaminowanego

Compressing the information contained in the different indexes is crucial for performance when implementing an IR system

Convolution semigroups with linear Jacobi parameters

OBWIESZCZENIE MINISTRA INFRASTRUKTURY. z dnia 18 kwietnia 2005 r.

UZUPEŁNIA ZESPÓŁ NADZORUJĄCY EGZAMIN W KLASIE TRZECIEJ GIMNAZJUM Z JĘZYKA ANGIELSKIEGO POZIOM PODSTAWOWY KWIECIEŃ miejsce na naklejkę z kodem

EXTERNAL ASSESSMENT SAMPLE TASKS POLISH BREAKTHROUGH LSPPOLB/0Y06

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Sargent Opens Sonairte Farmers' Market

Rachunek lambda, zima

Dominika Janik-Hornik (Uniwersytet Ekonomiczny w Katowicach) Kornelia Kamińska (ESN Akademia Górniczo-Hutnicza) Dorota Rytwińska (FRSE)

Financial support for start-uppres. Where to get money? - Equity. - Credit. - Local Labor Office - Six times the national average wage (22000 zł)

Techniki multimedialne

Linear Classification and Logistic Regression. Pascal Fua IC-CVLab

JĘZYK ANGIELSKI ĆWICZENIA ORAZ REPETYTORIUM GRAMATYCZNE


Arrays -II. Arrays. Outline ECE Cal Poly Pomona Electrical & Computer Engineering. Introduction

SNP SNP Business Partner Data Checker. Prezentacja produktu

Surname. Other Names. For Examiner s Use Centre Number. Candidate Number. Candidate Signature

EGZAMIN MATURALNY Z JĘZYKA ANGIELSKIEGO

Has the heat wave frequency or intensity changed in Poland since 1950?

Systemy zapisu liczb.

ABOUT NEW EASTERN EUROPE BESTmQUARTERLYmJOURNAL

Architektura systemów komputerowych Laboratorium 5 Kodowanie liczb i tekstów

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Rev Źródło:

Angielski bezpłatne ćwiczenia - gramatyka i słownictwo. Ćwiczenie 7

Machine Learning for Data Science (CS4786) Lecture 24. Differential Privacy and Re-useable Holdout

Transkrypt:

Introduction to Computer Science Numeral systems Piotr Fulma«ski Faculty of Mathematics and Computer Science, University of Šód¹, Poland October 21, 2010

Table of Contents 1 Numbers and their systems 2 Types of numeral systems

Number Number A number is an abstract idea used in counting and measuring. A symbol or a word in natural language which represents a number is called a numeral. Numerals dier from numbers just as words dier from the things they refer to. The symbols 11, eleven and XI are dierent numerals, all representing the same number. In common usage the word number is used for both the idea and the symbol. In addition to their use in counting and measuring, numerals are often used for labels (telephone numbers), for ordering (serial numbers), and for codes (ISBNs).

Numeral system Numeral system A numeral system (or system of numeration) is a framework where a set of numbers are represented by numerals in a consistent manner. It can be seen as the context that allows the numeral 11 to be interpreted as the binary numeral for three, the decimal numeral for eleven, or other numbers in other system.

Types of numeral systems Unary numeral system The simplest numeral system is the unary numeral system, in which every natural number is represented by a corresponding number of symbols. If the symbol / is chosen, for example, then the number seven would be represented by ///////. Tally marks represent one such system still in common use. This type of system, when the number is a sum of symbols, we can also called additive numeral system.

Abbreviated unary numeral system Abbreviated unary numeral system The unary notation can be abbreviated by introducing dierent symbols for certain new values. Very commonly, these values are powers of 10; so for instance, if / stands for one, - for ten and + for 100, then the number 304 can be compactly represented as +++ //// and number 123 as + - - /// without any need for zero. This is called sign-value notation. The ancient Egyptian system is of this type, and the Roman system is a modication of this idea. More useful still are systems which employ special abbreviations for repetitions of symbols; for example, using the rst nine letters of our alphabet for these abbreviations, with A standing for one occurrence, B two occurrences, and so on, we could then write C+ D/ for the number 304. The numeral system of English is of this type ("three hundred [and] four"), as are those of virtually all other spoken languages, regardless of what written systems they have adopted.

Rzymski system liczbowy Rzymski system liczbowy Symbol Warto± I 1 (unus) V 5 (quinque) X 10 (decem) L 50 (quinquaginta) C 100 (centum) D 500 (quingenti) M 1000 (mille)

Rzymski system liczbowy Dodatkowe symbole Kreska pionowa liczba umieszczona mi dzy kreskami byªa mno»ona przez 100 MD = (1000 + 500) 100 = 150000 Nadkre±lenie liczba nad któr wyst powaªa kreska byªa mno»ona przez 1000 MD = (1000 + 500) 1000 = 1500000 Dodatkowe zaªo»enia Ka»dorazowe wyst pienie symbolu o mniejszej warto±ci przed symbolem o wi kszej warto±ci oznacza odejmowanie (od wi kszego mniejsze). Jako poprawne uwa»a si zapisy bardziej zwarte, np. IV zamiast IIII.

Rzymski system liczbowy Dodatkowe symbole Kreska pionowa liczba umieszczona mi dzy kreskami byªa mno»ona przez 100 MD = (1000 + 500) 100 = 150000 Nadkre±lenie liczba nad któr wyst powaªa kreska byªa mno»ona przez 1000 MD = (1000 + 500) 1000 = 1500000 Dodatkowe zaªo»enia Ka»dorazowe wyst pienie symbolu o mniejszej warto±ci przed symbolem o wi kszej warto±ci oznacza odejmowanie (od wi kszego mniejsze). Jako poprawne uwa»a si zapisy bardziej zwarte, np. IV zamiast IIII.

Nowadays system Nowadays system Nowadays, the most commonly used system of numerals is known as Hindu-Arabic numerals, and two great Indian mathematicians could be given credit for developing them. Aryabhatta of Kusumapura who lived during the 5th century developed the place value notation and Brahmagupta a century later introduced the symbol zero.

Meaning of nowadays numbers 111=?! III=?! 1 1 10 1 100 1

Znaczenie dzisiejszych liczb Obserwacja 1 We wspóªczesnych systemach liczbowych pozycja cyfry w liczbie ma istotne znaczenie.

Meaning of nowadays numbers 115=?! IIV 5 5 10-1 100 1

Znaczenie dzisiejszych liczb Obserwacja 2 We wspóªczesnych systemach liczbowych znaczenie cyfry nie zale»y od kontekstu (innych symboli otaczaj cych).

Meaning of nowadays numbers Meaning of nowadays numbers We use three times the same symbol: 1 but in each case it has dierent meaning. What is important, the mining does not depend on other sorrounding symbols (does not depend on context) but depend only on position of symbol in our number. Znaczenie dzisiejszych liczb 304 =?! 304 = 300 + 0 + 4 = 10 2 3 + 10 1 0 + 10 0 4

Meaning of nowadays numbers Meaning of nowadays numbers We use three times the same symbol: 1 but in each case it has dierent meaning. What is important, the mining does not depend on other sorrounding symbols (does not depend on context) but depend only on position of symbol in our number. Znaczenie dzisiejszych liczb 304 =?! 304 = 300 + 0 + 4 = 10 2 3 + 10 1 0 + 10 0 4

Meaning of nowadays numbers Meaning of nowadays numbers We use three times the same symbol: 1 but in each case it has dierent meaning. What is important, the mining does not depend on other sorrounding symbols (does not depend on context) but depend only on position of symbol in our number. Znaczenie dzisiejszych liczb 304 =?! 304 = 300 + 0 + 4 = 10 2 3 + 10 1 0 + 10 0 4

Positional system Positional system More elegant is a positional system, also known as place-value notation. Again working in base 10, we use ten dierent digits 0,..., 9 and use the position of a digit to signify the power of ten that the digit is to be multiplied with, as in 304 = 3 100 + 0 10 + 4 1. Note that zero, which is not needed in the other systems, is of crucial importance here, in order to be able to skip a power. The Hindu-Arabic numeral system, borrowed from India, is a positional base 10 system; it is used today throughout the world.

Some observations Some observations Arithmetic is much easier in positional systems than in the earlier additive ones; furthermore, additive systems have a need for a potentially innite number of dierent symbols for the dierent powers of 10; positional systems need only 10 dierent symbols (assuming that it uses base 10).

Positional system Denition A positional numeral system or place-value numeral system) we called pair (b, D), where b is a natural number called the base or radix of the numeral system and D is a nite set of b symbols {s 0, s 1,..., s b 1} called digits or numerals a. System taki nazywamy systemem liczbowym o podstawie b (ang. base-b system). Je±li b = 10 to taki system b dziemy nazywa tak»e dziesi tnym, je±li b = 2 dwójkowym, je±li b = 8 ósemkowym, itd. a Zazwyczaj zbiór D skªada si z odpowiedniej liczby pocz tkowych symboli tworz cych ci g {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} i je±li zajdzie taka potrzeba to kolejnych liter alfabetu ªaci«skiego: A, B,..., przyjumj c zasad,»e A oznacza dziesi, B jedyna±cie, itd.

Systemy pozycyjne Znaczenie In such a system each number is represented as a sequence of digits and its value depends both on digits and position of digit it that sequence. Value v of sequence d k d k 1... d 1 d 0 obliczamy wedªug poni»szej formuªy gdzie d 0,..., d k D. v = d k b k + d k 1b k 1 +... + d 1 b 1 + d 0 b 0 (1)

Positional system Remark Using at one time several dierent positional systems, we have to write numbers with an information about base. Consider followin examples: 11 10 - number of decimal value 11 written in the base-10 (decimal) system, 11 2 - number of decimal value 3 written in the base-2 (binary) system, 11 5 - number of decimal value 6 written in the base-5 system, 11 25 - number of decimal value 26 written in the base-25 system.

Positional system Remark Using at one time several dierent positional systems, we have to write numbers with an information about base. Consider followin examples: 11 10 - number of decimal value 11 written in the base-10 (decimal) system, 11 2 - number of decimal value 3 written in the base-2 (binary) system, 11 5 - number of decimal value 6 written in the base-5 system, 11 25 - number of decimal value 26 written in the base-25 system.

Positional system Remark Using at one time several dierent positional systems, we have to write numbers with an information about base. Consider followin examples: 11 10 - number of decimal value 11 written in the base-10 (decimal) system, 11 2 - number of decimal value 3 written in the base-2 (binary) system, 11 5 - number of decimal value 6 written in the base-5 system, 11 25 - number of decimal value 26 written in the base-25 system.

Positional system Remark Using at one time several dierent positional systems, we have to write numbers with an information about base. Consider followin examples: 11 10 - number of decimal value 11 written in the base-10 (decimal) system, 11 2 - number of decimal value 3 written in the base-2 (binary) system, 11 5 - number of decimal value 6 written in the base-5 system, 11 25 - number of decimal value 26 written in the base-25 system.

Positional system Remark Using at one time several dierent positional systems, we have to write numbers with an information about base. Consider followin examples: 11 10 - number of decimal value 11 written in the base-10 (decimal) system, 11 2 - number of decimal value 3 written in the base-2 (binary) system, 11 5 - number of decimal value 6 written in the base-5 system, 11 25 - number of decimal value 26 written in the base-25 system.

Binary system Conversion from base-2 (binary) into base-10 (decimal) system Examples :) Conversion from base-10 into base-2 system Examples :) Arithmetic in base-2 system Examples :)

Binary system Conversion from base-2 (binary) into base-10 (decimal) system Examples :) Conversion from base-10 into base-2 system Examples :) Arithmetic in base-2 system Examples :)

Binary system Conversion from base-2 (binary) into base-10 (decimal) system Examples :) Conversion from base-10 into base-2 system Examples :) Arithmetic in base-2 system Examples :)

10010:11=110 1111001:1011=1011

Real numbers in base-2 system Assumption Saying real number we mean signless real number or a number with integer and fractional part without sign a. a Podobnie jak dla liczb caªkowitych, nie nale»y postrzega prezentowanego zapisu liczby rzeczywistej jako tego, który jest stosowany w komputerze w sposób bezpo±redni.

Real numbers in base-2 (binary) system Real numbers in base-10 (decimal) system Dziesi tna reprezentacja liczby rzeczywistej r jest wyra»eniem postaci r = I, d 1 d 2 d 3... gdzie I stanowi cz ± caªkowit liczby r wyra»on w postaci dziesi tnej, natomiast d 1, d 2, d 3,... s cyframi tworz cymi cz ± uªamkow liczby r. Obie cz ±ci rozdziela separator, tj. znak przecinka (,). Warto± v takiego wyra»enia obliczamy wedªug wzoru v = v I + d 1 10 1 + d 2 10 2 + d 3 10 3 +..., gdzie v I jest warto±ci cz ±ci caªkowitej I.

Liczby rzeczywiste w systemie binarnym Liczby rzeczywiste w systemie dziesi tnym Poniewa» I wyrazi mo»emy jako I = + d 3 10 3 + d 2 10 2 + d 1 10 1 + d 0 10 0 wi c ostatecznie otrzymujemy v = + d 3 10 3 + d 2 10 2 + d 1 10 1 + d 0 10 0 +d 1 10 1 + d 2 10 2 + d 3 10 3 +... co w zwi zªej postaci zapisujemy jako v = i= d i 10 i

Liczby rzeczywiste w systemie binarnym Obserwacja 3 Zapis cz ± uªamkowej jest podobny do zapisu cz ±ci caªkowitej, ale u»ywamy ujemnych wykªadników zamiast dodatnich.

Liczby rzeczywiste w systemie binarnym Liczby rzeczywiste w systemie binarnym Je»eli teraz nasze rozwa»ania przeniesiemy do systemu dwójkowego, to warto± cz ±ci uªamkowej b dzie wyliczana na podobnej zasadzie (zmieni si jedynie podstawa), zatem: a warto± caªej liczby to v = d 1 2 1 + d 2 2 2 + + d n 2 n v = i= Oczywi±cie w tym wypadku cyfry s elementami zbioru {0, 1}. d i 2 i

Liczby rzeczywiste w systemie binarnym Obserwacja 4 Binarne liczby rzeczywiste tworzy si i interpretuje analogicznie do dziesi tnych liczb rzeczywistych, ale zamiast podstawy 10 u»ywa si jako podstawy liczby 2.

Liczby rzeczywiste w systemie binarnym Konwersja cz ±ci uªamkowej z systemu binarnego do systemu dziesi tnego Przykªady :) Konwersja cz ±ci uªamkowej z systemu dziesi tnego do systemu dwójkowego Przykªady :)

Liczby rzeczywiste w systemie binarnym Konwersja cz ±ci uªamkowej z systemu binarnego do systemu dziesi tnego Przykªady :) Konwersja cz ±ci uªamkowej z systemu dziesi tnego do systemu dwójkowego Przykªady :)

Liczby caªkowite w systemie o podstawie n Przykªady Przykªady dla n = 3, 7, 13, 25 Przykªady Przykªady dla n = 4, 8, 16

Liczby caªkowite w systemie o podstawie n Przykªady Przykªady dla n = 3, 7, 13, 25 Przykªady Przykªady dla n = 4, 8, 16