The small problem was propagated way back to Exercise 2 where you are to build the f_of_omega function.
There are two things that you can try:
Try using ‘float64’ (which is the default) instead of ‘float32’
Try to rewrite this function with only 1 line of code (recommended). Because Python already does matrix operation, i.e. matrix multiplied by scalar, and there is no need to write a for loop for each value of the prices to calculate f_of_omega. But as far as I know, your function still works fine. I’m just not sure if it will pass all the tests.
First, be very careful replying to old threads. This assignment has been updated many times, and information you read on the forum may not be applicable.
Second, the grader is very specific about what math it expects you to implement.
For example in the f_of_omega() function, your code will not pass the grader (due to internal floating point representations) unless you implement the math exactly as given in the instructions (shown below):
@JorgeAldana, I’m sure that you have resolved your issues, but I wanted to respond to this thread to relate my own experience.
It’s interesting that your error is just a matter of significant digits- your value is essentially correct. It just goes to more digits.
I used float32, and I was able to pass. What was weird in my experience is that I failed two of eight tests locally, getting really strange values. When I ran the same solution in the lab notebook, however, everything passed. I suspect this is caused by something in the JAX module.