Assignment1 help


UFuncTypeError Traceback (most recent call last)
in
1 # Test your solution
----> 2 w2_unittest.test_augmented_to_ref(augmented_to_ref)

~/work/w2_unittest.py in test_augmented_to_ref(target)
342
343 for test_case in test_cases:
→ 344 result = target(test_case[“input”][“A”], test_case[“input”][“b”])
345
346 try:

in augmented_to_ref(A, b)
38
39 # multiply row 3 of the new matrix A_ref by -1/17
—> 40 A_ref[3] *= (-1/17)
41 ### END CODE HERE ###
42 return A_ref

UFuncTypeError: Cannot cast ufunc ‘multiply’ output from dtype(‘float64’) to dtype(‘int64’) with casting rule ‘same_kind’

i am getting this error … i dont understand whats the issue

(edited)

Try using 1. and 17.

same error

The hints for the assignment say this:

Is there are reason you are not using the MultiplyRow() function?

I do not think the modify-in-place operator ‘*=’ works on matrices.

Can we get a new assignment folder - I have deleted some of the original code in there

Go to the File menu, rename your ipynb notebook file, then go to the Help button in the upper right corner, and get the latest version.

That didn’t work - I have my old code still there and the assignment hasn’t restarted

What do you mean by “assignment hasn’t restarted”?

A screen capture image would be helpful.

All good - when I opened it up again, it refreshed

One final question - do you use the matrix from Exercise 1 in Exercise 3?

No.

The code you write in Exercise 3 should use only the parameters that are passed to each function.
That matrix is referred to as “M”, and the first thing each function does is create a copy called “M_new”.

Your code should modify the matrix M_new.

To test your code, Exercise 3 uses its own matrix “A_test”.

Thanks for that - I’ve got the code working but the testing code is throwing up this error:

The w2_unittest function is imported when you run the first cell in the notebook.

You must run all the cells every time you open the notebook.

Thank you it fixed that error

No matter how many times I correct the code I still get the wrong answer for Exercise 3 onwards. Is there anyway you can help? (Been at it for 2 weeks now)

Check your private messages for instructions.