Hi,
I've ran into a little problem. I myself have been using Game Maker for a quite some time, making various different codes isn't a problem for me... or at least I thought so.
Usually I don't use very small real numbers, like 0.000005, because it just seems pointless for me, but now as far as I need to make a precise Gauss-Jordan calculation, I've found out, that the show_message() doesn't output values that are below 0.01, instead it will output 0.00. All in all, I'm sure that there is a problem in the code itself, rather than in GML limitations
///scrInit()
/* Defines the function ^^^
Code: ... */
var i, j, k, N;
det = 1;
N = get_integer("Enter the number of Xn values",0);
for(i=0;i<N;i++)
for(j=0;j<N+1;j++)
a[i,j] = get_integer("Input the values (x1a,x2a,x3a,b1a):",0);
for (i=0;i<N;i++)
for (j=0;j<N;j++)
if (i!=j)
{
t=a[j,i]/a[i,i];
for (k=0;k<N+1;k++)
a[j,k]-=a[i,k]*t;
}
for (i=0;i<N;i++)
det*=a[i,i];
show_message("Det = "+string(det));
if (det==0) {
show_message("The matrix is singular.");
exit;
}
show_message("The matrix is...");
for(i=0;i<N;i++)
{
for(j=0;j<N+1;j++)
show_message(string(a[i,j]));
}
show_message("The result is...");
for (i=0;i<N;i++)
show_message("x["+string(i+1)+"]="+string(a[i,N]/a[i,i]));
Author of original Gauss-Jordan Method: Jivan Nepali, @URL: codeplustech
Aucun commentaire:
Enregistrer un commentaire