# Numerical Analysis Project.

Numerical Analysis Project.

Each individual problem is marked out of a total of 100% and broken down as indicated in
the right-hand margin. All problems carry equal marks.
You should submit the following document for this coursework:
1. A professionally-typed pdf document (no hand-writing, or smartphone photos of hand-
written solutions), preferably formatted in Latex, containing answers to all the ques-
tions. You must answer the questions in order. Do not present the information as
a report, just copy the questions and sub-questions (including the marks they carry)
into your report and answer them clearly. Include any Matlab functions and scripts
(appropriately commented to facilitate reading) used to attempt the coursework within
your answers. These are just presented for checking; the pdf document should be self-
contained and markable without reference to the Matlab codes and without the need
to run the scripts; e.g. if a script produces an output answer, clearly state what the
answer is; if a script produces a plot, clearly display the plot.
Students are encouraged to discuss the coursework together, but you should write your
own individual code and answers to questions. The programs and question answers will be
checked for similarities.
1
2
1. Consider a function f(x) with rst derivative df
dx . The rst-order accurate forward
di erence scheme to df
dx at a point x = x0 is given by:
df
dxFD
(x0) =
f(x0 + x) ?? f(x0)
x
(1)
Similarly, the central di erence, second-order accurate scheme is given by:
df
dxCD
(x0) =
f(x0 + x) ?? f(x0 ?? x)
2x
(2)
Choose f(x) = sin x and write a Matlab script that plots on log-log scale the two errors
j df
dxFD(x0) ?? df
dx (x0)j and j df
dxCD(x0) ?? df
dx (x0)j vs x at a particular point, say x0 = 1.
Comment on the slope of the two traces in relation to the order of accuracy of the
scheme. Comment as well on the error when x becomes very small. [100%]
2. ? Part A
Consider the expression:
1
(x)2 (fi+1 ?? 3fi + fi??1 + fi??2): (3)
Is this a consistent approximation of d2f
dx2 (xi)? [40%]
? Part B
Consider the di erential equation
@u
@t
+
@4u
@x4 = 0: (4)
Utilise a systematic derivation method to construct a nite-di erence approxima-
tion of the spatial derivative using the following stencil:
@4u
@x4 (xi) 
a??2ui??2 + a??1ui??1 + a0ui + a1ui+1 + a2ui+2
(x)4
[50%]
Following through with the systematic derivation, what is the order of the trun-
cation error in this approximation? [10%]
3
3. This problem is about nding the integral of functions using numerical techniques.
? Part A
Consider a function f(x) = ax6+bx4+cx2+dx+e where a; b; c; d; e take non-zero
values of your choice. Compute (analytically) the integral:
Z 1
??1
f(x) dx: (5)
stating clearly what your choice of values for a; b; c; d; e is. [10%]
Write a piece of code in Matlab to nd an approximation to
R 1
??1f(x) dx using
the Trapezium rule. Use your code to investigate how the error between the
approximate and analytical answer changes as the number of trapezoidal sub-
intervals is increased. [15%]
Now write another piece of code in Matlab to nd an approximation to
R 1
??1f(x) dx
using the Gauss-Legendre quadrature rule. Progressively increase the number of
quadrature points and at each stage check the error between your Gauss-Legendre
integral and the analytical one. How many quadrature points do you need before
you match the analytical answer? How does this relate to the degree of f(x)? [25%]
? Part B
Find an approximation to the integral
Z 8
1
loge x
x
dx: (6)
using the Trapezium rule in a Matlab code that you write. Compare the answer for
the approximated integral with the exact result 2.162038563 for di erent values of
trapezoidal sub-interval. How many sub-intervals are required to match 3 decimal
places? How many sub-intervals are required to have a relative error less than
0.0015%? [25%]
Evaluate the same integral now by writing a code in Matlab that uses a Gauss-
Legendre quadrature with the option to vary the number of quadrature points in
the range 4 to 8. Note that the limits of the integral required are not the standard
4
domain ??1  x  1 required by the Gauss-Legendre quadrature scheme
Z 1
??1
f(t) dt =
Xn
j=1
Ajfj (7)
and so you require a change of variable x = a+b
2 + b??a
2 t and dx = b??a
2 dt.
How many decimal places of accuracy have been reached using this scheme (for
value 2.162038563? What relative error is obtained (for various quantities of
How does this compare with the Trapezium rule? [25%]
4. ? Part A
(a) Write 2.0, 0.5 and 0.3 rst in binary, and then in the format a computer
would store them (i.e. using a 1:mantissa2c format. Note: there is no need
in this exercise to express c in binary). [15%]
(b) Computers typically store numbers in binary. Let’s consider you have a very
primitive computer whose mantissa; Hint: the computer only stores the
mantissa, i.e. gets rid of the rst 1) can only store the rst 5 digits of a
(a) to 5 mantissa digits, and then convert these truncated numbers back to
decimal form. What has happened? Why? What are the implications for the
performance of your primitive computer? [20%]
? Part B
Suppose f(x) has ve roots within [a; b]. Which of the roots will bisection nd
if it begins with x = a and x = b? Hint: Consider cases where the roots are i)
evenly and ii) unevenly spaced in the region [a; b]. [25%]
? Part C
This problem is about the xed-point method. Consider f(x) = ex ??3×2 = 0 has
5
three real roots. An obvious arrangement is
x = 
r
ex
3
Show that convergence is to the root near -0.5 if we begin with x0 = 0 and use
the negative value of g(x). Show also that convergence to a second root near 1.0
is obtained if x0 = 0 and the positive value is used. Show, however, that this
form does not converge to the third root near 4.0 even though a starting value
very close to the root is used. Find a di erent arrangement that will converge to
the root near 4.0. General hint: you may nd that evaluating g0(x) for x close to
the required roots reveals important information. [40%]

College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 1
Lab: Cisco Router ACL Configuration
In 1980, Stanford University asked Bill Yeager to figure out a way to let various mainframes communicate in their Medical Center, Computer Science Department, and

Electrical Engineering Department. Six months later the Multiprotocol router was born. In 1984 Cisco was founded by Stanford engineers Leonard Bosack and Sandra

Lerner, and by 1986 they shipped their first TCP/IP router. Now Cisco is the standard in switching and routing technology.
In this lab you will configure a router to allow three computers on different subnets to communicate. We will be using the GNS3 Graphical Network Simulator and VPCS

Virtual PC Simulator. This basic router configuration would be used to connect 3 different subnets, such as 3 floors of offices in a building or 3 departments in an

organization.
Objectives:
In this lab exercise, you will accomplish the following goals:
? Configure the VPCS virtual machines.
? Create the network topology in GNS3.
? Configure the router, the router’s port, and the dynamic routing protocol.
? Ping from one machine to another to show connectivity
? Observe the packets you created to test the network and the packets the router uses to determine its own topology.
? Put the address of one of the VPCS virtual machines into the access control list.
? Ping from one machine to another to show connectivity, or a lack of connectivity in order to verify the success of the ACL rule.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 2
Lab Setup Diagram
.
?
? Remember to read the report requirements at the end of this document before you start the lab to see what is necessary to hand into the instructor.
? Unless otherwise stated by the instructor, this lab is to be completed as a team. The report is to be written as a team.
Configuration
1. In this lab, you will be using a Linux virtual machine.
2. We will use the software GNS3 to configure the hardware (3 networks, a switch and a Cisco router).
Introduction
Access Control Lists are lists of rules used to control network traffic. They can be written to deny, allow, limit or forward traffic based on qualities of the

individual packet. In network security the ACL is probably the most used feature on any router. After you configure your network to route traffic and function as you

would like, you will be tweaking the ACL’s on a semi regular basis to deny access to new threats or to allow new devices to function. As a network security

professional, it is important for you to understand the basic theories and techniques surrounding the Access Control List.
Most access control lists look like a basic text file. They usually start with a list of rules allowing or denying traffic based on address, port, protocol, content or

any other measureable quality of the packet. Then they end with a final rule allowing any traffic that does not apply to the earlier rules or a final rule that denies

access to any packet that does not apply to the rules. A skilled Network Security Professional will lock down all traffic that does not belong on their network, thus

College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 3
Task 1 – Setup 3 PCs to Test the Network Later
Step 1 Logon to VM Ware as directed from the “Getting Started” document.
Step 2 You may need to logon to the Linux virtual machine with the user name “Administrator” (no quotes). The password is “password” (no quotes).
Step 3 On the virtual machine, at the menu at the top, go to Applications > Education > VPCS. VPCS is used to create two virtual PCs to test the emulated network that

we will set up later in this lab.
Step 4 The initial screen of VPCS will look like this one. Prompt “VPCS 1 >” means that you are currently in virtual PC #1. We will refer to this virtual PC in this

document as “vpcs1.” We will create “vpcs2” and “vpcs3” soon.
Step 5 Set up the network configuration of vpcs1. We will place vpcs1 in network 192.168.0.0 (denoted as cloud 1 in the lab setup diagram, page 1). In the VPCS window,

type in the following command: (Note: Do not type in “VPCS 1 >”. Just type in the command.)
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 4
In the above command, the first argument is the IP address to be assigned to vpcs1, the second argument is the IP address of the default gateway which vpcs1 is

connected to, and the last argument is CIDR (Classless Inter-Domain Routing) notation of the network mask (i.e., 255.255.255.0 in this case) denoting the network

Default Gateway is the IP address used as an entry and exit point to a network. It is also the address that packets are sent to when the destination IP address does

not match any addresses in the Routing Table. In this lab, the default gateway addresses are the ports that serve as access points to each of the subnets.
Step 6 Let us create vpcs2 by typing in the following command in the VPCS window. After pressing the enter key, the prompt will change to “VPCS 2 >”
Step 7 We will place vpcs2 in the 192.168.0.0 network, denoted as cloud 2 in the lab setup diagram. Type in the following command to assign IP address 192.168.0.12 to

vpcs2.
The above command also sets the IP address 192.168.0.1 as the default gateway of vpcs2.
Step 8 Let us create vpcs3 by typing in the following command in the VPCS window. After pressing the enter key, the prompt will change to “VPCS 3 >”
Step 9 We will place vpcs3 in network 192.168.1.0, denoted as cloud 3 in the lab setup diagram. Type in the following command to assign IP address 192.168.1.11 to

vpcs3.
Now, we have finished setting up the virtual PCs to communicate through a router. Let us set up an experimental network where vpcs1, vpcs2, and the router are placed.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 5
Task 2 – Configure the Hardware.
Step 1 To setup the experimental network as shown in the lab setup diagram, go to and click on Applications > Education > gns3 Graphical Network Simulator.
Step 2 Type in a new project name (say “Ciscolab”) in the New Project window, check all the checkboxes, and click Okay. (You can use the default destination or create

Step 3 Drag and drop “Router c3600,” 3 “Clouds” and an Ethernet switch from the left pane (i.e., Nodes Types) to the middle pane (a blank area) as shown below: (If

these items are extremely small, go to View > Zoom in. Note that the clouds in Clockwise order are 1,3,2 (not 1,2,3). You should make them the same.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 6
Step 4 To configure C1, right click on C1, and select “Configure.” In the configuration window, select C in the left pane, and select the NIO UDP tab. Type in “30000”,

“127.0.0.1”, and “20000” for Local port, Remote host, and Remote port respectively. Click Add. On success, you will see “nio_udp:30000:127.0.0.1:20000” on the NIOs

pane. Click Okay.
Step 5 For C2 and C3, repeat the same procedure to configure it. But, this time, use “30001”, “127.0.0.1”, and “20001” for Local port, Remote host, and Remote port

respectively on C2 (on success, you will see “nio_udp:30001:127.0.0.1:20001”) and “30002”, “127.0.0.1”, and “20002” for Local port, Remote host, and Remote port on C3.

Click Add (on success, you will see “nio_udp:30002:127.0.0.1:20002”) on the NIOs pane. Click Okay.
Step 6 Let us connect the router to C1, C2, and C3. Click the ‘add a link’ icon () in the toolbar, and select FastEthernet. The icon will turn into , which means you

a. Let us add a link between the switch and C1. Click on the switch, click C1, and a menu pops up. Select “nio_udp:30000:127.0.0.1:20000” in the popup menu. Repeat the

same steps for the switch and C2.
b. Now click on the switch and then the router.
c. Now click on the R1 and then C3, and select “nio_udp:30002:127.0.0.1:20002”.
e. Also, you can toggle showing interface names by clicking the icon in the toolbar.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 7
Step 7 R1 is initially turned off. Turn R1 on by right-clicking R1 and selecting Start.
Step 8 Turn on the router. Now, you can configure R1 through Cisco IOS. To enter IOS, right click R1, and select Console. On success, a window named “R1” pops up.
In the R1 window, it may ask you to go into “set up mode.” “If so, type “No” or enter to get to the router prompt. If it does not ask you to go into “set up mode” just

press “Enter” to get to the “R1#” prompt as pictured below.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 8
Step 9 Type the following commands to configure R1. Tip: Use the up-arrow key to recall previously entered commands.
Entering configuration mode and configuring individual line:
Configuring interfaces connected to C1, C2, and C3:
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 9
Configuring Routing Information Protocol (RIP):
RIP is the dynamic routing protocol used in ARPANET, the original Internet. RIP calculates how long route packets take by comparing the number of hops the packet

requires to reach its destination. RIP maintains a routing table on each router which it keeps accurate by sending routing update messages regularly and whenever the

network topology changes.
You can also find detailed description of each command.
Typing the ‘?’ key at the prompt will give you a list of all commands that you can use in current state.
Typing a command followed by the ‘?’ character will give you details on the parameters of the command.
Step 10 Go to the VPCS window. Type “1” to switch to vpcs1. Ping vpcs2 (192.168.1.12) using the following command. If you have successfully configured everything, you

will see connectivity from vpcs1, through the router to vpcs2, then to vpcs3.
Also, try the following commands to ping from vpcs2 to vpcs1 and vpcs3.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 10
Also, try the following commands to ping from vpcs3 to vpcs1 and vpcs3.
The following commands may be useful in verifying virtual PC configuration. Command “show” shows the configuration of all virtual PCs.
Command “ping” can be used to check if a virtual PC is connected to the network. Using the “Lab Setup Diagram” on page 1 of this document, determine if your networks

are connected to the router. Start at Cloud 1, ping the router interface before the router, ping the router interface after the router and ping Cloud 2.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 11
Task 3 – Configure Access Control List and Test
In this scenario you are the Network Administrator, the Intrusion Detection System Analyst calls you at 3:00 am. He is receiving attack traffic from a machine. It

seems C2 has been infected with malware and needs to be cut off from the network. Here you will set an access control list on the interface to stop all traffic with

the infected host while allowing traffic from the uninfected host to continue. Then you get to go back to bed.
Step 1 Begin to configure and deploy the ACL by opening the Router console:
(this command is only needed if you closed down the terminal and reopened a new one)
This command creates an extended access list named 101, and puts you in a position to edit that list.
This command denies all traffic between the infected host and the host we wish to protect.
This command allows traffic between all other hosts and the machine we wish to protect. The access list starts at the top of the list and continues till it finds a

rule that applies to the packet it is examining and then stops looking. So adding this permit rule at the end allows any traffic not affected by the deny rule to

continue.
This command applies the access list we prepared to the inbound traffic of the interface closest to the infected host.
This set of commands will create a list of rules that will deny access between the infected system while permitting traffic with the uninfected system.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 12
Step 2 Test the ACL. Return to the VPCS screen. Type “1” to switch to vpcs1. Ping vpcs2 (192.168.0.12) using the following command below. You will see connectivity

from vpcs1, through the router to vpcs2, then to vpc3.
Also, try the following commands to show connectivity from vpcs2 to vpcs1 and vpcs3.
Also, try the following commands to show connectivity from vpcs3 to vpcs1 and vpcs2.
Now if the access list is working properly there should be connectivity between all of the hosts except 192.168.0.12 and 192.168.1.11.
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 13
Official Cisco Guide
http://www.cisco.com/en/US/products/sw/secursw/ps1018/products_tech_note09186a00800a5b9a.shtml
Easier to understand article
http://articles.techrepublic.com.com/5100-10878_11-5731134.html
Cool Video
Part 1

Part 2

Part 3

Report:
Clearly state your results of this project. You are expected to hand in a report in the following format:
? A cover page (including Lab title) with your name or team name.
? Use double-spaced type for convenient grading.
? Number pages. Font size 12, single column.
? Save the Microsoft Word document with your name or team name in the title. Upload the document into the appropriate ANGEL dropbox.
The report should have the following sections. Each section should cover all the topics described below (you do not need to itemize each topic though). Take

screenshots if it is necessary.
Section I: Introduction
You should have the following parts:
1. Describe the goal and motivation of this project. In addition to what has been stated in the project instruction, please explain your own expectations in this

project.
Briefly describe what was done in each of the 3 Tasks:
a. Describe what was done in Task 1 and analyze your results.
a. Describe what was done in Task 2 and analyze your results.
b. Be sure to include a screenshot of your router fully connected to the three subnets. (Task 2, Step 6 – In your screenshot, make sure the router is also turned on.
c. Be sure to include a screenshot of your ping results from each subnet to the other two subnets. (Task 2, Step 11)
a. Describe what was done in Task 3 and analyze your results.
b. Include a screenshot of your results when you ping after preventing access from subnet 2 and 3. (Task 3, Step 2)
College of Information Sciences and Technology
Network Management and Security: Cisco ACL
rev: 1/19/2014 by smj11
©Copyright 1999-2015 | The Pennsylvania State University, College of Information Sciences and Technology Page 14
Section III:
You should have the following parts:
1. Research one of the links at the top of page 16. Write a 100 word paragraph in your own words on something interesting that you found.
Section IV: Experiment Log
? This part should describe your activities in this project.
? Clearly state the responsibility of each group member. If possible, give a table to tell who did which task, who collected information of which device, who wrote

which part of the report, who coordinated the group work activities, etc.
? Give a log of your group activity, such as what you did on which day, and how many people attended.
This project has a number of specific requirements. The requirement for each section is documented in the above project instruction “Report.” Whether you receive

credit depends on the following situations:
? You will get full credit on one item, if it is correctly reported as required and well written.
? You will get half credit on one item, if it is reported as required but there is something definitely wrong.
? You will not get any credit for one item, if it is not reported.
Credit for each section is as follows.
1. Section I: Introduction (10%):
2. Section II: Screenshots (70%):
3. Section III: 100 word paragraph (10%):
2. Section IV: Experiment Log (10%):
Note
Be sure to include your name and email address in the report. The report should be turned in before class on the specified due date. Late submissions will be issued a

grade deduction especially if permission is not obtained from the instructor. The instructor reserves the right to grant or reject extra time for report completion.

PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT 🙂