Add your own alternative version
Stats
92.6K views 4.2K downloads 42 bookmarked
Posted
16 Dec 2004

Comments and Discussions



Should be using CultureInfo.InvariantCulture in all long.ToString() and double.ToString() calls:
854: str=this.Numerator.ToString(CultureInfo.InvariantCulture);
901: string strTemp=dValue.ToString(CultureInfo.InvariantCulture);
902: while ( strTemp.IndexOf("E", System.StringComparison.Ordinal)>0 )
906: strTemp = dTemp.ToString(CultureInfo.InvariantCulture);





I found some wrong methods names
For example Minor is determinant of the matrix, not the matrix
Determinant called "determinent" everywhere
Adjoint()  not so good name because overloaded in english math.
Better "adjugate matrix"
But very usefull logic, thx.





I seem to have found an inaccuracy in your matrix class. Maybe you can double check my work.
Running ReducedEchelonForm seems to give me the wrong answer.
original:
254 100 25400 1 209
255 100 25500 1 229
254 255 64770 1 37
255 255 65025 1 45
http://www.math.purdue.edu/~dvb/matrix.html
1 0 0 0 27.7419
0 1 0 0 18.5548
0 0 1 0 0.0774
0 0 0 1 6726.4839
Mehroz.Matrix.ReducedEchelonForm():
1 0 0 0 0.173639781582127
0 1 0 0 0.403086852796957
0 0 1 0 10.539255084245
0 0 0 1 2.2554885064207





Hi,
I ran the my tests against your sample data and seem to get the correct output (matching the one you posted from the link). Here's the code I tried:
int[,] values = new int[,]
{
{254, 100, 25400, 1, 209 },
{255, 100, 25500, 1, 229 },
{254, 255, 64770, 1, 37 },
{255, 255, 65025, 1, 45}
};
Matrix matrix = new Matrix(values);
Matrix ech = matrix.ReducedEchelonForm();
Can you recheck your code?
Regards,
Syed Mehroz Alam
My Blog  My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination.  Albert Einstein





I'm a chinese learner, Use the MatrixClass.cs to want to get my resualts, but can not...
Can you use my arrA,arrB and Matrix to get the resualt? help me, please!
double[,] arrA = { { 99.07, 70, 1.6, 1.1, 0, 0, 25, 0 }, { 0.31, 15.7, 0.45, 0.3, 0, 0, 1.34, 0 }, { 0.05, 0.2, 30.52, 54.5, 0.09, 0, 50, 0 }, { 0.05, 0.2, 21.32, 2.1, 0.08, 0, 0, 0 }, { 0.23, 13, 0, 0, 42.77, 58.2, 0, 72.28 }, { 0, 0, 0, 0, 42.77, 0, 0, 0 }, { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 67.2, 0.8, }, { 0, 0, 0, 0, 1.71, 2.3, 0.8, 69.96 } }; ; //array of coefficients
double[,] arrB = { { 72 * 100 }, { 1.2 * 100 }, { 8.3 * 100 }, { 4 * 100 }, { 14.0 * 100 }, { 0.042 * 100 }, { 0 }, { 0 } };





In fact, I ran this piece of code in Europe, and guess what? It collapsed!
My computer replaced the decimal dot in doubles by a comma, so the parser was not able to find the dot.
But the answer is not to search both dots and commas. The answer is to format the number properly.
dValue.ToString(CultureInfo.InvariantCulture);
Have fun with this little update!
Petr Sladek
alias slady





I noticed your code has difficulty handling situations when you try to assign a double .3333333333333333333333 into your Fraction class. Is there anyway it can be modified to recognize .33333333333333333333 is 1/3.
Matt





Many of you would have noticed that the result of equation solving code example does not satisfy the given system of equation. The problem is that the value of constants given in the equations does not match with the array of constants in the code block. The correct system of equation which complies with the code and hence the answer is:
X + 2Y  3Z = 2
4X  2Y  Z = 5
X  Y  2Z = 3
I regret for this mistake.
Syed Mehroz Alam
Email: smehrozalam@yahoo.com
Homepage: Programming Home
URL: http://www.geocities.com/smehrozalam/







General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

