Exam 1 Take Home
Root Solving Methods
1) Bisection
Water vapor splits into gaseous Hydrogen and Oxygen according to 2π»2π → 2π»2 + π2. The mole fraction π of π»2π can be found from the equation
where π is a reaction equilibrium constant and ππ‘ is the total pressure of the mixture (in atmospheres). Solving this equation for π analytically is challenging, but because the mole fraction fundamentally varies from 0 to 1, a bracketed root finding method is well-suited to solve the problem.
Use a bisection method to solve for mole fraction π given π = 0.04 and ππ‘ values varying from 0.25 atm to 10 atm. Solve the problem at many ππ‘ values in that range and graph π vs.
ππ‘ (π should be on the vertical axis). Each data point in your graph will be built using the bisection method. You should use a loop to solve the bisection method many times for many different values of ππ‘
2) Newton-Raphson
Write a Newton-Raphson code for the function to find a solution of cos(π₯) sin(π₯) = 0.4. Write the code twice, running with 2 different starting guesses.
a) Choose a starting guess where the code returns an error or the method diverges (Please comment this out before submitting if it generates an error)
b) Choose a starting guess where the method converges and a root is found
Eigenvalue problem – The popularity problem
The google search algorithm, in its infancy, solved a problem in linear algebra called the popularity problem. It attempts to answer the following question in a straight forward yet sophisticated way:
If I ask a group of π websites which among the other π − 1 sites are the most popular, how can I rank each website’s popularity?
The simplest method is just count links. Every time a website is linked to, its popularity increases by 1. But this is problematic, and doesn’t always give results that people agree with. Maybe one site is linked to many times, but it is exclusively from sites that are unpopular themselves. Also, maybe certain sites contain a ton of links, so their individual links shouldn’t carry as much weight.
We would like to find the popularity of each website, where instead of simply counting links, we sum the popularity of each website that linked to each other website.
Read the following paragraph slowly and several times.
Let π ππ be a 1 or a 0 depending on whether or not the ππ‘β website linked to the ππ‘β website, and let ππ be the popularity of the ππ‘β website. In that case, a sensible expression for the popularity of the 1st website would be
π1 = π 12π2 + β― π 1πππ
So, for example, if website 1 was linked to by websites 3, 4, and 5, then website 1’s popularity
π1 would be given by
π1 = π3 + π4 + π5
We could write a similar equation for every single website π ∈ 1 … π. This creates a system of equations of the form
π Μ πβ = πβ
where R is a matrix containing all of the π ππ entries, and πβ is an unknown column vector containing the popularities of each website.
This should be immediately recognizable as an eigenvalue problem. Remember, the eigenvalue equation is π΄Μ π₯β = ππ₯β
It is not at all clear that the above equation (π Μ πβ = πβ) would, in general, have a solution. That’s because it isn’t a general eigenvalue equation. It specifically has an eigenvalue of 1. An arbitrary matrix π Μ will not necessarily have that eigenvalue. However, we can fix this problem if we enforce the following rule: every column of π must sum to 1. If every column adds up to one,
the matrix is guaranteed to have 1 as an eigenvalue, and the above equation will have a solution. Essentially, each website is only allowed to give one total “link”, evenly distributed amongst all the different websites it links to. The above fact is not obvious or simple to prove.
The ππ‘β column of the R matrix, again, is the number of times the ππ‘β website linked to the others. If we take each column and divide it by its sum, it will then meet our requirement. That is to say, we normalize each column, individually, so they all sum to 1. If the 5th website linked to you, but it also linked to 9 other websites, you only get an π value of 0.1. And that means that
website 5’s contribution to your popularity is not π5, but is only 0.1π5.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme