Solve using visual basic, c#, or c++
Solution :-
Program for to do gauss Elimination for a set of simultaneous linear eqations......
import java.util.Scanner;
/* Class GaussianElimination*/
public class GaussianElimination
{
public void solve(double[][] A, double[] B)
{
int N = B.length;
for (int k = 0; k < N; k++)
{
/* find pivot row */
int max = k;
for (int i = k + 1; i < N; i++)
if (Math.abs(A[i][k]) > Math.abs(A[max][k]))
max = i;
/* swap row in A matrix */
double[] temp = A[k];
A[k] = A[max];
A[max] = temp;
/* swap corresponding values in constants
matrix*/
double t = B[k];
B[k] = B[max];
B[max] = t;
/* pivot within A and B*/
for (int i = k + 1; i < N; i++)
{
double factor = A[i][k] / A[k][k];
B[i] -= factor * B[k];
for (int j = k; j < N; j++)
A[i][j] -= factor * A[k][j];
}
}
/* Print row echelon form*/
printRowEchelonForm(A, B);
/* back substitution*/
double[] solution = new double[N];
for (int i = N - 1; i >= 0; i--)
{
double sum = 0.0;
for (int j = i + 1; j < N; j++)
sum += A[i][j] * solution[j];
solution[i] = (B[i] - sum) / A[i][i];
}
/*print solution */
printSolution(solution);
}
/* funtion to print in row echelon form */
public void printRowEchelonForm(double[][] A, double[] B)
{
int N = B.length;
System.out.println("\nRow Echelon form : ");
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
System.out.printf("%.3f ", A[i][j]);
System.out.printf("| %.3f\n", B[i]);
}
System.out.println();
}
/* function to print solution */
public void printSolution(double[] sol)
{
int N = sol.length;
System.out.println("\nSolution : ");
for (int i = 0; i < N; i++)
System.out.printf("%.3f ", sol[i]);
System.out.println();
}
/* main function*/
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Gaussian Elimination Algorithm Test\n");
/* make an object of gaussianElimination class
*/
GaussianElimination ge = new GaussianElimination();
System.out.println("\nEnter number of variables");
int N = scan.nextInt();
double[] B = new double[N];
double[][] A = new double[N][N];
System.out.println("\nEnter "+ N +" equations coefficients
");
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
A[i][j] = scan.nextDouble();
System.out.println("\nEnter "+ N +" solutions");
for (int i = 0; i < N; i++)
B[i] = scan.nextDouble();
ge.solve(A,B);
}
}
Solve using visual basic, c#, or c++ 1. Write a program to do the Gauss Elimination...
The pscudocode shown below solves a system of n linear algebraic equations using Gauss-Jordan 125] elimination. DOFOR -1,n DOPOR 1 = k + 1,n + 1 END DO ae 1 DOFOR 1 = 1, n k THEN IF i DOFOR j- k+1,n+ 1 ENDDO END IF END DO END DO DOFOR m-1,n END DO Write a Matlab function program GaussJordan(A,n) which implements this algorithm and a) returns the solution. Here A is the augmented matrix consisting of the coefficient matrix...
Write a program in Matlab that solves linear systems of equations using Gauss elimination with partial pivoting. Make sure that you use variables that are explicit, and make sure to include comment lines (each subroutine should have at least a sentence stating what it does). Make sure that your program checks for valid inputs in matrix and vectors dimensionality. • Using your code, solve the systems of equations in problems 9.11, 9.12, and 9.13 9.11 9.12 9.13 2x1-6x2-X3 =-38 We...
Write an advanced function (a program) in MATHCAD to perform Gauss-Jordan Elimination. Your program should be able to handle problems of any size. Remember that you MUST explain each and every line of code with comments. (Preferable with for loops)
Please do all steps 3. Use Gauss Elimination method to solve X1 + 1.5%-3x,--10 2X1-X2-2X3 = 5 2x1 - 2x2 + 5x3 6 i, Put the equation in the matrix form ii. Show the forward elimination steps i. Show the backward substitution steps
1. Use Gauss-Jordan Elimination to solve the following system of equations. You must show all of your work identifying what row operations you are doing in each step. Do not use a graphing calculator in order to reduce the matrix or you will not receive credit for the problem.. 2x -4y + 6z-8w-10 -2x +4y +z+ 2w -3
2,3, 6, 7 1. Without matrices, solve the following system using the Gaussian elimination method + 1 + HP 6x - Sy- -2 2. Consider the following linear system of equation 3x 2 Sy- (a) Write the augmented matrix for this linear system (b) Use row operations to transform the augmented matrix into row.echelon form (label all steps) (c) Use back substitution to solve the linear system. (find x and y) x + 2y 2x = 5 3. Consider the...
VISUAL BASIC- create a program for managing a "To Do" list. The program will need to read and update a text file named ToDoList.txt. The record structure of the file must be: 1) sort order, 2) task name and 3) desired completion date. When the program starts, it should read the contents file into a structure. The information should then be displayed in a data grid view. The data should be initially sorted by the sort order value. Afterwards, the...
1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. 2. Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was m,...
Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions. • void getScore() should ask the user for a test score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...
1. (20 points total) We will solve the following system of linear equations and express the problem and solution in various forms. 2x1 + 4x2 + x4 – 25 = 1 2.22 - 3.23 – 24 +2.25 = 1. (a) (2 point) How many free parameters are required to describe the solution set? (b) (5 points) Write the problem in the form of an augmented matrix and use Gauss-Jordan elimination to find the reduced echelon form of the matrix. (c)...