Calculus Week 1 Exercise 2 - Arrays look identical f_of_omega

Hi,

I am working on Exercise 2 and am receiving these errors. The arrays are identical. Please let me know if you’ve faced a similar error:

1 Like

I have not seen this error before. I’ll check into it further.
The test for this function was recently updated. Maybe the update is incorrect.

@snigdhasaha we made some changes to the unittests recently. Could you please try to open the environment and submit that again? Please let me know how it goes.

I am getting the exact same error, and I know my code is correct. Please advise. See attached (I did not include the line we need to code.)

@esanina see here: C2_W1 errors in function w1_unittest.test_f_of_omega(f_of_omega) - #3 by peajay03

I went ahead and debugged w1_unittest.py for you all. There are two errors in the file that I was able to correct, and when corrected, the function generated the passing result that is expected. Bottom line, if you’re going to ask the user/student to define data as float32, you have to make sure your function defines the matrices using the same float values, and you need to allow for tolerances in case there are small differences.

Please LMK when updated, so I can proceed with the unit. Thank you.

1 Like

I inspected the unit test code and I am getting errors when I run it , too. I thought that I made a mistake, but it could be related to the tolerance. But something appears to be off with the unit test code? may be syntax issue? Can I resent the notebook? Test case “default_check”. Wrong output of f_of_omega for omega = 0.
Expected:
[ 76. 76. 84. 79. 81. 84. 90. 93. 93. 99. 98. 96. 94. 104.
101. 102. 104. 106. 105. 103. 106. 104. 113. 115. 114. 124. 119. 115.
112. 111. 106. 107. 108. 108. 102. 104. 101. 101. 100. 103. 106. 100.
97. 98. 90. 92. 92. 99. 94. 91.]
Got:
[ 76. 76. 84. 79. 81. 84. 90. 93. 93. 99. 98. 96. 94. 104.
101. 102. 104. 106. 105. 103. 106. 104. 113. 115. 114. 124. 119. 115.
112. 111. 106. 107. 108. 108. 102. 104. 101. 101. 100. 103. 106. 100.
97. 98. 90. 92. 92. 99. 94. 91.]
Test case “extra_check_1”. Wrong output of f_of_omega for omega = 0.2.
Expected:
[ 81.6 82.4 87.40001 84. 85.200005 88.200005
94.8 94.8 95.4 99.40001 100.200005 97.4
93.8 102.8 99.200005 101. 102.40001 103.600006
103.4 101. 104.600006 101.8 110. 110.8
109.8 117.600006 114.40001 111.6 109.2 107.4
104.200005 106. 107. 106.4 101.6 104.00001
100.8 101.4 100.8 102.600006 105.200005 100.
98. 100. 93.4 95. 94.2 101.00001
96.8 94.4 ]
Got:
[ 81.6 82.4 87.40001 84. 85.200005 88.200005
94.8 94.8 95.4 99.40001 100.200005 97.4
93.8 102.8 99.200005 101. 102.40001 103.600006
103.4 101. 104.600006 101.8 110. 110.8
109.8 117.600006 114.40001 111.6 109.2 107.4
104.200005 106. 107. 106.4 101.6 104.00001
100.8 101.4 100.8 102.600006 105.200005 100.
98. 100. 93.4 95. 94.2 101.00001
96.8 94.4 ]
Test case “extra_check_2”. Wrong output of f_of_omega for omega = 0.8.
Expected:
[ 98.4 101.6 97.600006 99.00001 97.8 100.8
109.200005 100.2 102.6 100.600006 106.8 101.600006
93.200005 99.200005 93.8 98. 97.600006 96.40001
98.6 95. 100.40001 95.200005 101. 98.200005
97.200005 98.4 100.600006 101.4 100.8 96.600006
98.8 103. 104. 101.6 100.4 104.00001
100.2 102.600006 103.200005 101.4 102.8 100.
101. 106. 103.6 104. 100.8 107.00001
105.200005 104.600006]
Got:
[ 98.4 101.6 97.600006 99.00001 97.8 100.8
109.200005 100.2 102.6 100.600006 106.8 101.600006
93.200005 99.200005 93.8 98. 97.600006 96.40001
98.6 95. 100.40001 95.200005 101. 98.200005
97.200005 98.4 100.600006 101.4 100.8 96.600006
98.8 103. 104. 101.6 100.4 104.00001
100.2 102.600006 103.200005 101.4 102.8 100.
101. 106. 103.6 104. 100.8 107.00001
105.200005 104.600006]
Test case “extra_check_3”. Wrong output of f_of_omega for omega = 1.
Expected:
[104. 108. 101. 104. 102. 105. 114. 102. 105. 101. 109. 103. 93. 98.
92. 97. 96. 94. 97. 93. 99. 93. 98. 94. 93. 92. 96. 98.
98. 93. 97. 102. 103. 100. 100. 104. 100. 103. 104. 101. 102. 100.
102. 108. 107. 107. 103. 109. 108. 108.]
Got:
[104. 108. 101. 104. 102. 105. 114. 102. 105. 101. 109. 103. 93. 98.
92. 97. 96. 94. 97. 93. 99. 93. 98. 94. 93. 92. 96. 98.
98. 93. 97. 102. 103. 100. 100. 104. 100. 103. 104. 101. 102. 100.
102. 108. 107. 107. 103. 109. 108. 108.]
4 Tests passed
4 Tests failed

just reran. Still failing.

It’s being investigated. Sorry for the troubles.

@peajay03 thank you for the investigation of the problem. The unit tests file is updated now.

@johnthomascook please let me know if you will have some issues.