Ahmadomari

20 Reputation

3 Badges

11 years, 339 days

MaplePrimes Activity


These are answers submitted by Ahmadomari

I found the problem that when the Jacobean function solve the same equation many time it gives deferent order for the evaluated equations from time to time, the answer of the Jacobin is right because the addition is associated but when you proceed to find the coefficient then the answer is not right because if A a variable at the end of the equation you get the coefficient at the end and if it is at the beginning then you will get the coefficient of on the beginning. That will affect the solution of the matrix because sometimes the constant terms will come from the end to the beginning to the middle and vise versa depending on how the Jacobean shuffle the equations. I suggest for the company on the next maple version to keep consistant solution for the Jacobin function when it solves the same equation many times without any shuffle and I hope to get free software for that!!. The solution for this problem as following:

 

 

> restart;
> Data := readdata("ObservData.txt", 13);

Chisqr1 := proc (w, SubunitIndex) local x, y, A, B, C, D, j, X, altern1, altern2, altern3, altern4, EqCo1, EqCo2, EqCo3, EqCo4, M, XX, M1, M2, MM, ChiSqr, Syss, S;

x := linalg:-vector([0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48]);

y := Data[SubunitIndex];

for j to 13 do S := S+(y[j]-A-x[j]*B-C*cos(w*x[j])-D*sin(w*x[j]))^2 end do;

Syss := Student:-MultivariateCalculus:-Jacobian([S], [A, B, C, D]);

X := LinearAlgebra:-Transpose(Syss);

altern1 := simplify(LinearAlgebra:-Determinant(X[1]));

altern2 := simplify(LinearAlgebra:-Determinant(X[2]));

altern3 := simplify(LinearAlgebra:-Determinant(X[3]));

altern4 := simplify(LinearAlgebra:-Determinant(X[4]));

M := Matrix([[coeff(altern1, A), coeff(altern1, B), coeff(altern1, C), coeff(altern1, D), tcoeff(altern1)], [coeff(altern2, A), coeff(altern2, B), coeff(altern2, C), coeff(altern2, D), tcoeff(altern2)], [coeff(altern3, A), coeff(altern3, B), coeff(altern3, C), coeff(altern3, D), tcoeff(altern3)], [coeff(altern4, A), coeff(altern4, B), coeff(altern4, C), coeff(altern4, D), tcoeff(altern4)]]);

M2 := linalg:-gaussjord(M);

A := M2[1, 5];

B := M2[2, 5];

C := M2[3, 5];

D := M2[4, 5];

S := 0;

for j to 13 do S := S+(y[j]-A-x[j]*B-C*cos(w*x[j])-D*sin(w*x[j]))^2 end do

end proc;

for indexSubunit to 292 do MinChiSqr := 1000000000000;

for wx to 200 do ChiSqr2 := Chisqr1(8-1+.14371, indexSubunit);

Std := sqrt((1/13)*ChiSqr2);

MinChiSqr := min(Std, MinChiSqr) end do;

printf("%f\n", MinChiSqr)

end do;

I found the problem that when the Jacobean function solve the same equation many time it gives deferent order for the evaluated equations from time to time, the answer of the Jacobin is right because the addition is associated but when you proceed to find the coefficient then the answer is not right because if A a variable at the end of the equation you get the coefficient at the end and if it is at the beginning then you will get the coefficient of on the beginning. That will affect the solution of the matrix because sometimes the constant terms will come from the end to the beginning to the middle and vise versa depending on how the Jacobean shuffle the equations. I suggest for the company on the next maple version to keep consistant solution for the Jacobin function when it solves the same equation many times without any shuffle and I hope to get free software for that!!. The solution for this problem as following:

 

 

> restart;
> Data := readdata("ObservData.txt", 13);

Chisqr1 := proc (w, SubunitIndex) local x, y, A, B, C, D, j, X, altern1, altern2, altern3, altern4, EqCo1, EqCo2, EqCo3, EqCo4, M, XX, M1, M2, MM, ChiSqr, Syss, S;

x := linalg:-vector([0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48]);

y := Data[SubunitIndex];

for j to 13 do S := S+(y[j]-A-x[j]*B-C*cos(w*x[j])-D*sin(w*x[j]))^2 end do;

Syss := Student:-MultivariateCalculus:-Jacobian([S], [A, B, C, D]);

X := LinearAlgebra:-Transpose(Syss);

altern1 := simplify(LinearAlgebra:-Determinant(X[1]));

altern2 := simplify(LinearAlgebra:-Determinant(X[2]));

altern3 := simplify(LinearAlgebra:-Determinant(X[3]));

altern4 := simplify(LinearAlgebra:-Determinant(X[4]));

M := Matrix([[coeff(altern1, A), coeff(altern1, B), coeff(altern1, C), coeff(altern1, D), tcoeff(altern1)], [coeff(altern2, A), coeff(altern2, B), coeff(altern2, C), coeff(altern2, D), tcoeff(altern2)], [coeff(altern3, A), coeff(altern3, B), coeff(altern3, C), coeff(altern3, D), tcoeff(altern3)], [coeff(altern4, A), coeff(altern4, B), coeff(altern4, C), coeff(altern4, D), tcoeff(altern4)]]);

M2 := linalg:-gaussjord(M);

A := M2[1, 5];

B := M2[2, 5];

C := M2[3, 5];

D := M2[4, 5];

S := 0;

for j to 13 do S := S+(y[j]-A-x[j]*B-C*cos(w*x[j])-D*sin(w*x[j]))^2 end do

end proc;

for indexSubunit to 292 do MinChiSqr := 1000000000000;

for wx to 200 do ChiSqr2 := Chisqr1(8-1+.14371, indexSubunit);

Std := sqrt((1/13)*ChiSqr2);

MinChiSqr := min(Std, MinChiSqr) end do;

printf("%f\n", MinChiSqr)

end do;

 

Page 1 of 1