
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)
As a personal preference I don't like the idea of Gauss elimination with back substitution. So I'm not going to make any of you go through that pain either. basically I want you to write a program that takes a set of linear equations like this: 5w+2x+2y+3z = 15 -11w-3x+5y-7z = -2 2w+4x-6y = -21 w+2y+2z = 4 Although I will probably not give you any more than ten equations in ten unknowns your program has to be able to...
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
Visual Basic 2017: Create a program to do the following: Fill a string array with the grades from a file with the statement: (note the grades.txt is on moodle and must be placed in the project’s bin/Debug folder for proper execution) Dim GradeStr() As String = IO.File.ReadAllLines(“grades.txt”) Then do the following steps: • Dim another array called Grades() of type double to the same size as the string array • Convert and copy each element from the string array GradeStr()...
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,...