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)
A=0;
x=0;
n=input('How many variables=');
disp('Enter the coefficients along with constants For instance if
x+y+3z=-5 then enter 1 1 3 -5 each number followed by an enter not
space');
for i=1:n
for j=1:n+1
A(i,j)=input('');
end
end
%pivoting
for i=1:n-1
for j=i+1:n
if
abs(A(j,i))>abs(A(i,i))
T=A(j,:);
A(j,:)=A(i,:);
A(i,:)=T;
end
end
end
disp('After pivoting');
disp(A);
for k=1:n-1
for i=k+1:n
m=A(i,k)/A(k,k);
for j=k:n+1
A(i,j)=A(i,j)-m*A(k,j);
end
end
end
disp('Triangularize Form ');
disp(A);
if A(n,n)==0
disp('No unique solution');
end
x(n)=A(n,n+1)/A(n,n);
for j=n-1:-1:1
sum=0;
for i=1:n
sprintf('x%.0f=%.10f',i,x(i))
end
for i=1:n-j
sum=sum+A(j,n+1-i)*x(n+1-i);
end
x(j)=(A(j,n+1)-sum)/A(j,j);
end
Write an advanced function (a program) in MATHCAD to perform Gauss-Jordan Elimination. Your program should be...
Solve using visual basic, c#, or c++ 1. Write a program to do the Gauss Elimination procedure for a set of simultaneous linear equations. The input is a comma separated file of numbers. Write the program in the following phases. Ensure each phase runs correctly before you proceed to the next phase. a. Write a computer program to open a.csv file, and read the contents an augmented matrix of n columns and n +1 rows. The program should display the...
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...
Matlab Question. Please be detailed Write a user-defined function that performs LU decomposition (using Gauss Elimination without partial pivoting) of a square matrix. Do not use built-in MATLAB functions lu( ), inv(), \, linsolve(). Matrices (in [A]*{x}={B} form) A=[15 -3 -1; -3 15 -6; -4 -1 12] B=[3800; 1200; 2350] Given code lines: function[L,U]=myLUFact_username(A) [m,n]=size(A); %numbers of rows/comlumns of A assert(m==n, 'A should be a square matrix');
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...
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,...
. Please write a function that will do the following Decryption of a message encrypted with a substitution cipher given cipher text only without any key Please provide comments on each line of code outlining what that line is doing. Note: Only the Function is to be written, all user inputs i.e the text to be decrypted will be entered earlier in the program. Code must be written in C and be able to be compiled using GCC If any...
Your program write a program to test whether a number is prime or not. Your program should ask user to input an integer and respond: "Prime" or "Not prime". Don't use any library function that tests for prime numbers. The program should continue to ask for input, till it sees a 0, when it exits. Please submit printed pseudocodeshould ask user to input an integer and respond: "Prime" or "Not prime". Don't use any library function that tests for prime numbers....
write the program in c++ Pointen & A???ys: Write u function that is passed a pointer to a float array, and the size the array as an int. The function should return a pointer to the maximum element in the array The function should be: int *maxp(float* ap, int size) Write a main() program to lest the function with different input arrays. Grading Criteria (1 point each): Uses cin/cout correct function definition prompts user for input, reads it in correct...
Write a hash function to implement a digit-folding approach in the hash function. Your program should work for any array size and any key length. Use linear probing. Accessing a group of digits in a number may be easier than you think. Does it matter if the array size is not a multiple of 10?(Written in Java)
Write a hash function to implement a digit-folding approach in the hash function. Your program should work for any array size and any key length. Use linear probing. Accessing a group of digits in a number may be easier than you think. Does it matter if the array size is not a multiple of 10? #java#withcomments please