Here is the problem I need help with: I need to write the answer in code form, b
ID: 3823679 • Letter: H
Question
Here is the problem I need help with:
I need to write the answer in code form, but not in full code. Somewhere about 3 to 9 lines of code. The answer I was able to come up with is this:
x[n] = b[n] / a[n];
x[n-1] = (b[n-1] – c[n]*x[n]) / a[n-1];
for (i = n-2; i > 0; i--){
x[i] = (b[i] – c[i+1]*x[i+1] – d[i+2]*x[i+2]) / a[i];
for (j = 1; i < n; i++)
a[i+1] = a[i+1] – (b[i]/a[i])*c[i+1]; //endfor
}//endfor
I'm not sure if this is the correct answer for this problem. If it isn't, do I need to change variables or add another for loop?
Write an et algorithm to soluko icient an n x n system On23 with nonzero dia aonals the form I n-3 A-2 n 2. te that A is non singular and that pinating YOU should first convert fo an Upper trt angularExplanation / Answer
You have done a great job; but there is a fundamental fault. A matrix with row & column size greater than 1 is always a 2D array. So here matrix A is 2D array and since X & Y are matrices with column size 1, so they can be treated as 1D array.
Follow my code, it works well
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
m=a[j][i]/a[i][i];
for(k=i;k<n+1;k++)
a[j][k]=a[j][k]-(m*a[i][k]);
}
}
/*The above loop is used to convert A into upper triangular matrix*/
for(i=n-1;i>=0;i--)
{
s=0;
for(j=n-1;j>i;j--)
s+=(x[j]*a[i][j]);
x[i]=(y[i]-s)/a[i][i];
}
/*The above portion applies basic substituition*/