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

LU method does not pass the test, Gauss Siedel: no way to enter initial guess #2

Open
moharamfatema opened this issue Jan 4, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@moharamfatema
Copy link
Owner

moharamfatema commented Jan 4, 2022

LU method does not run as expected, the following error is generated :

  File "sys_linear_eqns_python\src\methods.py", line 124, in LU
    x[i] = y[i] / float(U[i][i])
IndexError: list assignment index out of range

the function call that caused this error was as follows:

a = numpy.array([[2, 1, 4, 1], [1, 2, 3, 1.5], [4, -1 ,2, 2]])
x = methods.LU(number_of_equations=3,input_equations=a)        

There's also a missing feature in the gauss_siedel method, There should be initial guesses for the solution that the user enters

If you want to regenerate the error or test the function you can run the tests in the tests directory

@moharamfatema moharamfatema added the bug Something isn't working label Jan 4, 2022
@moharamfatema moharamfatema changed the title LU method does not pass the test LU method does not pass the test, Gauss Siedel: no way to enter initial guess Jan 4, 2022
@moharamfatema
Copy link
Owner Author

Update on LU bug

The bug was just a typo, I fixed it. However, The method does not return correct results
I used the following input as a test:

 a = numpy.array([[2, 1, 4, 1], [1, 2, 3, 1.5], [4, -1 ,2, 2]])
 x = methods.lu_decomposition(number_of_equations=3,input_equations=a).get('solution')

The actual output = [0.25 , 0.77778, 2.75 ]
The expected (correct) output = [ 1, 1 , -0.5]

You'll find a few changes to the code that were necessary for the required output but I didn't change the logic of any of the functios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants