Lecture 23 Numeric and Symbolic Computing Numeric Computation

advertisement
Lecture 23
4/5/04 23:14
Lecture 23
Numeric and Symbolic
Computing
Numeric & Symbolic Computing
Computer Networks
(S&G, §§11.3
–11.4, 12.1–
§§11.3–
12.1–12.2)
4/5/04
CS 100 - Lecture 23
1
4/5/04
Numeric Computation
• Performance:
–
–
–
–
3
4/5/04
Symbolic Computing
( x −1)
– automate processes that are mechanical,
tedious, and error-prone
€
• Examples: Macsyma, Mathematica, Maple,
MatLab
CS 100
CS 100 - Lecture 23
CS 100 - Lecture 23
4
Example: Simplification
• Manipulate mathematical formulas,
equations, etc. much the way a
mathematician would
4/5/04
better algorithms
accessing of data in memory hierarchies
parallel computation
data communication in networks
• Mathematical software libraries
• Accuracy and stability of numerical
approximations
 a teraflop machine performs at least 1012 (a trillion)
floating-point operations per second
 36 Tflops already achieved (Japan’s Earth Simulator,
which cost $350–500M)
CS 100 - Lecture 23
2
Computer Science Issues
• Applications that make heavy use of real
arithmetic
• Especially used in science, engineering,
economics, statistics, animation
• The motivation for the first computers
• Still drives the development of supercomputers
and parallel computers
4/5/04
CS 100 - Lecture 23
2
2
+ ( x + 2) + (2x − 3) + x
• Simplify[(x-1)^2 + (x+2) +
(2x-3)^2 + x]
• 12 - 12x + 5x2
5
4/5/04
CS 100 - Lecture 23
6
1
Lecture 23
4/5/04 23:14
Example: Solving Equations
Example: Expansion
(1+ x + 3y )
4
2x + y = 11
6x − 2y = 8
• Expand[(1 + x + 3y)^4]
• Solve[ {2x + y == 11,
6x - 2y == 8},
{x,
€ y}]
• 1 + 4x + 6x2 + 4x3 + x4 + 12y
€
+ 36xy + 36x2y + 12x3y + 54y2
+ 108xy2 + 54x2y2 + 108y3
+108xy3 + 81y4
4/5/04
CS 100 - Lecture 23
• {{x -> 3, y -> 5}}
7
4/5/04
CS 100 - Lecture 23
8
Typical Expansion Rules
Digression
Expand[ X × (Y + Z )] ⇒ X × Y + X × Z
Expand[( X + Y ) × Z ] ⇒ X × Z + Y × Z
• Recall our discussion of formalized
mathematics, and the idea of reducing
mathematics to the mechanical application
of formal rules
• Formal rules: depend on the form of
expressions, not their meaning
• Symbolic computation is an application of
the idea of a calculus
Expand[ X 2 ] ⇒ X × X
Hence,
Expand[(n + 1)2]
€ ⇒Expand[(n + 1)(n + 1)]
⇒Expand[(n + 1)n + (n + 1)1]
⇒Expand[(n + 1)n + (n + 1)1]
⇒Expand[n×n + 1×n + n×1 + 1×1]
4/5/04
CS 100 - Lecture 23
9
4/5/04
CS 100 - Lecture 23
10
Computer Science Issues
• Symbolic computation systems are:
– very high-level languages
– problem-specific
– nonprocedural
Computer Networks
(S&G ch. 12)
• Depend on many algorithms, e.g.:
– pattern matching
– efficient management of complex data structures
representing formulas
• Results should be presented in a form familiar and
useful to the mathematically literate
4/5/04
CS 100
CS 100 - Lecture 23
11
4/5/04
CS 100 - Lecture 23
12
2
Lecture 23
4/5/04 23:14
Kinds of Networks
Communication Links
• Local Area Network (LAN)
• Switched dial-up phone lines
– limited range (building, campus)
– typically owned by owners of premises
– example: Ethernet
– require modem (modulator-demodulator) to
interface between digital interface and analog
phone line
• Wide Area Network (WAN)
• Dedicated links
– worldwide (and beyond!)
– typically owned by telecommunications
services
– example: Internet
– wired (wire proper & fiber optic cable)
– wireless
4/5/04
CS 100 - Lecture 23
13
4/5/04
CS 100 - Lecture 23
14
Single-Cable Ethernet
Ethernet
intended transmission
• Developed at Xerox PARC in mid-70s
• Communication protocols govern use of the
network
• Ethernet uses contention-based distributed
control
4/5/04
CS 100 - Lecture 23
15
4/5/04
Single-Cable Ethernet
(1) Listen
4/5/04
CS 100
CS 100 - Lecture 23
CS 100 - Lecture 23
16
Single-Cable Ethernet
(2) Transmit
17
4/5/04
CS 100 - Lecture 23
18
3
Lecture 23
4/5/04 23:14
Single-Cable Ethernet
(3) Broadcast
4/5/04
CS 100 - Lecture 23
Single-Cable Ethernet
(4) Receive
19
4/5/04
Single-Cable Ethernet
(5) Inactive
4/5/04
CS 100 - Lecture 23
CS 100
CS 100 - Lecture 23
20
Single-Cable Ethernet
(1) Listen
21
4/5/04
Single-Cable Ethernet
(2) Transmit
4/5/04
CS 100 - Lecture 23
CS 100 - Lecture 23
22
Single-Cable Ethernet
(3) Collision
23
4/5/04
CS 100 - Lecture 23
24
4
Lecture 23
4/5/04 23:14
Single-Cable Ethernet
(4) Wait Randomly
4/5/04
CS 100 - Lecture 23
Single-Cable Ethernet
(5) Listen
25
4/5/04
Single-Cable Ethernet
(6) Rebroadcast
4/5/04
CS 100 - Lecture 23
CS 100
CS 100 - Lecture 23
26
Single-Cable Ethernet
(7) Inactive
27
4/5/04
Single-Cable Ethernet
(8) Listen
4/5/04
CS 100 - Lecture 23
CS 100 - Lecture 23
28
Single-Cable Ethernet
(9) Rebroadcast
29
4/5/04
CS 100 - Lecture 23
30
5
Lecture 23
4/5/04 23:14
Collision Recovery
Wide Area Networks (WANs)
• LANs typically broadcast messages
• WANs typically use point-to-point
communication
• Typically use store and forward packetswitching
A:
wait
B:
wait
C:
wait
– packet = fixed-size quantity of information
– large messages divided into packets
time
4/5/04
CS 100 - Lecture 23
31
CS 100 - Lecture 23
33
4/5/04
Store-and-Forward Packet-Switching
A
32
CS 100 - Lecture 23
34
What We Need
C
• A way of finding a computer (“server”) on
the Internet
• A way of locating a Web page on that
computer
• A way of displaying that Web page on my
computer (“client”)
ACK
D: packet
D: packet
B
4/5/04
CS 100 - Lecture 23
Point-to-point Communication:
Node Failure
Point-to-point Communication
4/5/04
4/5/04
CS 100 - Lecture 23
35
4/5/04
CS 100 - Lecture 23
36
(slide < S. Levy)
CS 100
6
Lecture 23
4/5/04 23:14
Locating Computers
on the Internet
IP Format
• TCP/IP (Transmission Control Protocol/Internet
Protocol) – a set of protocols (“rules of the
game”) for making transactions
• IP address – standard for identifying a computer
CS 100 - Lecture 23
• 4 groups of 3 digits
• Range from 0 to 255 (8 bits)
• Total of 2564 or over 4 billion computers
• TCP – describes how packets are sent and
retrieved
4/5/04
• Example: 204.202.129.230
37
4/5/04
CS 100 - Lecture 23
(slide < S. Levy)
The Internet and the Web
The Internet and the Web
• The Web sits on top of the Internet and uses
its protocols (HTTP, FTP, MAILTO, etc.)
• URL (Uniform Resource Locator) – allows
different computers to use the same
protocols for Web-based transactions
• HTTP (HyperText Transfer Protocol)
format: http://where/what
e.g.,
http://www.cs.utk.edu/~cs100
4/5/04
CS 100 - Lecture 23
(slide adapted < S. Levy)
39
Internet
URL
HTTP, FTP,
MAILTO, ...
TCP
IP
4/5/04
CS 100 - Lecture 23
• Standard protocol (URL)
• Provide a name and get the computer
• Standard language for describing Web
(Domain Name Server) to translate it to the IP
pages (HTML – HyperText Markup
address
Language)
• HTML: A set of commands for formatting
Web pages
http://www.cs.utk.edu/~cs100
CS 100 - Lecture 23
(slide adapted < S. Levy)
40
Two Standards for Web Pages
• It’s hard to remember 12 digits
• e.g, http://160.36.56.64/~cs100 =
CS 100
Web
(slide < S. Levy)
Named Address (Domain Name)
4/5/04
38
(slide < S. Levy)
41
4/5/04
CS 100 - Lecture 23
42
(slide < S. Levy)
7
Lecture 23
4/5/04 23:14
How HTML Works: Client/Server
How HTML Works: Client-Side
• The spirit of HTML:
Server’s disk
1.
– Content (text, images, videos) + “suggestions”
on how to format it
– Hyper-links to other web pages
Network
connection
Client’s browser
The client sends a request for a page to the server.
2.
HTML code is sent as text to the client.
3.
4.
HTML code is stored in the client’s cache (temporary memory).
The client’s browser interprets the HTML code and formats
the page.
4/5/04
CS 100 - Lecture 23
43
• Actual formatting (fonts, positions, colors)
should be up to client’s browser (e.g., lynx
entirely text-based)
• In practice, web designers want more
control (frames, tables, blank spaces)
4/5/04
(slide < S. Levy)
CS 100 - Lecture 23
44
(slide < S. Levy)
Typical Network Services
• Resource sharing
– print servers, file , compute servers
Read S&G, ch. 13
(Artificial Intelligence)
for next class
• Information sharing
– data interchange, information utilities
• Communication
– e-mail, bulletin boards, news groups, chat
rooms
• Electronic commerce
• Security issues
– authentication, secrecy, fault tolerance
4/5/04
CS 100
CS 100 - Lecture 23
45
4/5/04
CS 100 - Lecture 23
46
8
Download