You are on page 1of 12

Table of Contents

Introduction .......................................................................................................................................... 2
Solving Equations of One Variable.................................................................................................... 3
Introduction ...................................................................................................................................... 3
.......................................................................................................................................................... 3
Translation ........................................................................................................................................ 3
Methodology ..................................................................................................................................... 4
Results & Discussion ........................................................................................................................ 4
Systems of Linear Equations .............................................................................................................. 5
Introduction ...................................................................................................................................... 5
Translation ........................................................................................................................................ 5
Methodology ..................................................................................................................................... 6
Results & Discussion ........................................................................................................................ 6
Probability ........................................................................................................................................... 7
Introduction ...................................................................................................................................... 7
Translation ........................................................................................................................................ 7
Methodology ..................................................................................................................................... 7
Results & Discussion ........................................................................................................................ 7
Appendix – Solving Equations of One Variable ................................................................................... 8
Appendix A....................................................................................................................................... 8
Appendix – Systems of Linear Equations ............................................................................................. 9
Appendix A....................................................................................................................................... 9
Appendix B ..................................................................................................................................... 10
Appendix – Probability ....................................................................................................................... 12
Introduction
All the questions respond to the following scenario: A truss bridge spans a narrow ravine and

allows traffic including heavy vehicles to access the hilltop town of Hilltown.

An underground waste water pipeline must cross the ravine, and this has been accomplished

using a trough slung underneath the bridge. In the worst possible combination of events, the

weight of the trough at capacity combined with the weight of vehicles crossing the bridge

may put some serious loads on the bridge truss elements, and cause catastrophe.

Figure 1: The Hilltown Truss Bridge (Assignment 1)


Solving Equations of One Variable

Introduction

The trough under the bridge, consists of an open half cylinder, as shown in figure 2. The total

mass of the water in the trough at any given time is given by the expression, shown in

Equation 1. The aim of the problem is to solve the equation, which determines the height of

the water from the top of the trough, given m [kg], r [m] and L [m].

Figure 2: The trough that lies under the truss bridge. (Assignment 1)

Equation 1: Total mass of water under truss bridge.

Translation

Equation 1 is used to determine the value of h [m]. It is evident that equation 1 is a non-linear

equation and can be solved using numerous numerical methods e.g. Bisection method,

Regula Falsi method etc. The solution to this problem is found by using the secant method.

The first step is to re-arrange the equation such that it equals zero (Equation 2).

0 = (𝑚/997 ∗ 𝐿) − (0.5 ∗ 𝑝𝑖) + (𝑎𝑠𝑖𝑛(ℎ)) + (ℎ ∗ (1 − ℎ. ^2 ). ^1/2);


Equation 2: Re-arranged equation of Equation 1.
Methodology

The secant method uses an approximation to the first derivative of the function and therefore

does not require the derivative to be computed explicitly.

Equation 3: Secant Algorithm.

The algorithm (Equation 3) needs two starting values to begin the iteration process. These

need not bracket the true root and, provided they are fairly close to it. The initial values

chosen for h [m] is 0 [m] and 50 [m]. The selected starting values were chosen such that it

satisfies the Bolzano theorem (f(xl)* f(xu)<0). A convergence test was also placed in the

code with the tolerance value of ep = 0.001. This would allow the root to be very accurate.

Results & Discussion

Figure 3: The results for Problem 1.

The value for h [m] when m = 50000 [kg], r = 1 [m] and L = 1 [m] is 1.714 [m] (3.d.p). The

secant method was solved on MATLAB and the script is provided in Appendix A. The

tolerance value that was used for the convergence test is ep = 0.001. The root displayed is

wrong as h is required to be between 0 and 1, where h < r, but in this case h>r which means

that the water is over-flowing. MATLAB outputted this value ‘17.136370114830473 +

0.008030999658258i’ which holds an imaginary component to it. I’m not sure how to fix this

issue, all the other methods output similar results.


Systems of Linear Equations

Introduction

The Hilltown truss bridge has a trough (Problem 1), suspended below the truss bridge by five

supports. A schematic of the forces experienced by each truss joint is contained in Figure 4.

The self-weight of the bridge and weight of the empty trough are neglected.

This problem requires to find the force in each truss element of the bridge f1−19 and the

support reactions F1, F2 and F3 simultaneously, when given the 5 forces R1, R2, R3, R4, R5.

The sum of the reaction forces is equal to when the trough holds 50,000 Kg of water.

It is assumed that all truss joints are pins, the left support is fixed, and the right support is free

to move horizontally.

Figure 4: Schematic of the truss with forces and joints annotated (Assignment 1)

Translation

Using the schematic of the truss (figure 4), the horizontal and vertical forces of each of the

joints was derived. From this, each equation was put in to a large matrix as shown in

Appendix A. The first matrix shows all the forces, the second matrix shows the amount of

force applied to a particular joint and the third matrix shows all of the reactions.
Methodology

The method used to find each of the forces in the joints when given, is Gaussian Elimination.

The MATLAB script is provided in Appendix B. The script first prompts the user to provide

the reaction forces from 1 to 5. After the user has entered values in Kilo-Newtons, the matrix

‘Q’ sends the matrix, with the reaction forces inputted, to ‘Gauss_Elim’ to solve for the

forces. The output is each of the forces, when the reaction forces is given.

Results & Discussion

Figure 6: The user-inputted values (100kN)

Figure 5: The forces in each joint, when reaction forces are given.

The following results, figure 5 & 6, show the forces in each joint when the reaction is given.
Probability
Introduction

Translation

Methodology

Results & Discussion


Appendix – Solving Equations of One Variable
Appendix A

%Solving Equations of One Variable


m = 50000; L = 50; r = 1; % Given Values
ep = 0.001; % Tolerance Value
hl = 0; hu = 50; %Lower guess = 0 ; Upper guess = 50
fu = ffh(hu); % Value of hu in the function ffh
fl = ffh(hl); % Value of hl in the function ffh
for i= 1:30 % Iteration begins with Max 30 iterations
h = hl - (fl*(hu - hl))/(fu - fl); % The Secant Method
fh1= ffh(h); % Value of m in the function ffm
z(i)=fh1; % Array holding f(m)
j(i)=i; % Array holding No. of iterations
if abs(fh1)< ep % Convergence TEST
ans1 = sprintf('The root is %d',h);
disp = (ans1)
i % Displays number of iterations i
break
end % End if statement
hu = hl;
fu = fl;
hl = h;
fl = fh1;
if i == 30 % if statement used to output error
message
disp('Error: Too many iterations (Max = 30)')
break % Exits for loop.
end % End if statement
end % Ends for loop

function fh = ffh(h)
fh = (50000/997*50)-(0.5*pi)+(asin(h))+(h *(1 - h.^2 ).^1/2);
end
Appendix – Systems of Linear Equations
Appendix A
Appendix B
% Q2 Systems of Linear Equations
% The below code will provide the magnitude of the forces in the
% truss element of the bridge (f1 - f19) and the support reactions
% (F1, F2, F3), when given the 5 Reaction Forces (R1, R2, R3, R4, R5).
%Requesting the reaction forces.
prompt = 'What is the Reaction Force of R1?(Respond in kN)--> ';
R1 = input(prompt)

prompt = 'What is the Reaction Force of R2?(Respond in kN)--> ';


R2 = input(prompt)
prompt = 'What is the Reaction Force of R3?(Respond in kN)--> ';
R3 = input(prompt)
prompt = 'What is the Reaction Force of R4?(Respond in kN)--> ';
R4 = input(prompt)
prompt = 'What is the Reaction Force of R5?(Respond in kN)--> ';
R5 = input(prompt)
%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1/sqrt(2),0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1/sqrt(2),-1,0,0,1,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1/sqrt(2),0,1,0,0,-R5;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1/sqrt(2),0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1/sqrt(2),-1,0];

[X,counts]= Gauss_Elim(Q); %Sending the matrix to solved to Gauss_Elim


%Reporting each of the forces to user.
fprintf('F1 = %2.2f kN ',X(1));
fprintf('F2 = %2.2f kN ',X(2));
fprintf('F3 = %2.2f kN \n',X(3));
fprintf('f1 = %2.2f kN ',X(4));
fprintf('f2 = %2.2f kN ',X(5));
fprintf('f3 = %2.2f kN ',X(6));
fprintf('f4 = %2.2f kN ',X(7));
fprintf('f5 = %2.2f kN \n',X(8));
fprintf('f6 = %2.2f kN ',X(9));
fprintf('f7 = %2.2f kN ',X(10));
fprintf('f8 = %2.2f kN ',X(11));
fprintf('f9 = %2.2f kN ',X(12));
fprintf('f10 = %2.2f kN \n',X(13));
fprintf('f11 = %2.2f kN ',X(14));
fprintf('f12 = %2.2f kN ',X(15));
fprintf('f13 = %2.2f kN ',X(16));
fprintf('f14 = %2.2f kN ',X(17));
fprintf('f15 = %2.2f kN \n',X(18));
fprintf('f16 = %2.2f kN ',X(19));
fprintf('f17 = %2.2f kN ',X(20));
fprintf('f18 = %2.2f kN ',X(21));
fprintf('f19 = %2.2f kN \n',X(22));
%----------------------------------------
%Gauss reduction with partial pivoting
%INPUTS: Augmented matrix A (size n,n+1)
%OUTPUTS: Solution vector X and # of operations
%----------------------------------------
function [X,counts,simtime] = Gauss_Elim(A)
counts=0;
[n,~]=size(A); %Read the size of matrix A,
save as 'n'
tic;
for i=1:n-1 %Do for each column k:
p=find(A(i:n,i),1); %Find the first nonzero element
in this column, starting with diagonal
if isempty(p) %If there are no nonzero
elements, matrix is singular - can't solve
error('Error: Matrix is singular');
end
p=p+i-1; %Reference p to actual matrix
position, not diagonal
if p~=i %If p is not equal to i,
interchange rows i and p.
pivot=A(p,:);
A(p,:) = A(i,:);
A(i,:) = pivot;
counts = counts+1;
end
for j=i+1:n %Perform elimination step
m(j,i)=A(j,i)/A(i,i); %Find the row multiplier
A(j,:)=A(j,:)-A(i,:)*m(j,i); %Eliminate row (ADD ; to this
line to stop output)
counts=counts+3;
end
end
if A(n,n) == 0
error('Error: Matrix is singular'); %Check last diagonal for
singularity
end
X(n) = A(n,n+1)/A(n,n); %Start back substitution:
counts=counts+1;
for i=n-1:-1:1 %Do for all x values working
backwards from n-1 to 1
X(i)=(A(i,n+1)-sum(A(i,i+1:n).*X(i+1:n)))/A(i,i); %Solve the back
substitution for X(i)
counts=counts+1;
end
simtime= toc;
end
Appendix – Probability

You might also like