Sei sulla pagina 1di 1

Tutorial 3. Gaussian-Elimination with Partial Pivoting.

#include <cmath>
#include <iostream>
using namespace std;
The forces (x) in the eight truss members, shown in Figure 1, are //
determined from a set of eight equations, derived by drawing free body int main()
diagrams of pins A, B, C, and D and applying equations of equilibrium. {
// Declaration
const int n = 8;
double a[ n ][ n ];
double b[ n ];
double fac=0.;
double sum=0.;
double x[ n ];
// Initialise a,x and b

// Setup a and b

// Pivot and eliminate

// Pivot

// Eliminate

// Substitute

// Output
for ( int j = 0; j < n; j = j + 1 )
{
Figure 1. cout << "j=" << j << " x=" << x[ j ]
<< "\n" << endl;
Develop, debug and test a program to solve the derived system of equations }
using Gaussian elimination with partial pivoting. Save and store your }
program for future use. The header, declaration and output part of the main
program are as follows: Run the program, display the program and results to the tutor.

//++++++++++++++++++++++++++++++++++++++++++++++++ ANSWER:___________________________
// geptq.cpp DATE:______________________________
// Gaussian elimination with forward MATRIC NO:________________________
// elimination, back substitution and partial STUDENTS SIGNATURE:_______________
// pivoting.
//++++++++++++++++++++++++++++++++++++++++++++++++

Potrebbero piacerti anche