Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-numerical Gaussian elimination #56

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WhiteBlackGoose
Copy link
Contributor

After implementing Gaussian elimination I actually discovered that it's not what I needed myself. Your type might not support >, <, >=, <= operators, thus, you need an analytical presentation of determinant. For example, I'm thinking of using Matrix for my symbolic algebra, but since we can't compare expressions, I needed that:

var a = new Matrix<Entity>(2, 2);
a[0, 0] = "x + 2";
a[1, 0] = "y";
a[0, 1] = "2 ^ x";
a[1, 1] = "z";
Console.WriteLine(a.DeterminantNonNumericGaussian().Simplify());

So I implemented it. Output for the example above:

(x + 2) * z - 2 ^ x * y

However, I think it requires some work. First, #55: I added a reflection check for that operator, but @ZacharyPatten you should probably rewrite it to meet your own views on this.

Not only that, you could actually consider replacing Gaussian with NonNumericalGaussian, I just don't know how to test it better.

for (int i = 0; i < n; i++)
det *= elemMatrix.Get(i, i);

return det.Value;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a check where det's Denominator is 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm but then it won't fully non-numeric. So if you take this method, you might want to add

if (det.IsDividedByZero)
    return Constant<T>.Zero;

@ZacharyPatten ZacharyPatten added the On Hold issues that are on hold for any reason label Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
On Hold issues that are on hold for any reason
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants