Closed poojashresthacode closed 9 months ago
@poojashresthacode I got the same runtime error, and which is due to singularly about x=0. You have to handle the singularly at x=0.
@poojashresthacode As you can see the function has indeterminate form at x=0, it will encounters errors or warning unless you resolve this singularity issue.
@poojashresthacode I have resolved this issue, you can see here: https://github.com/ubsuny/23-Homework6G5/pull/19
https://github.com/ubsuny/23-Homework6G2/issues/16 This can be of some help.
This is a possible way of dealing with a singularity: (https://github.com/ubsuny/23-Homework6G2/issues/47)
@LinxuanHu @AhmedCode99 @tirthbha ipython-input-8-fe2d73df47d6>:5: RuntimeWarning: divide by zero encountered in divide return np.cos(1 / x) :5: RuntimeWarning: invalid value encountered in cos return np.cos(1 / x) :5: RuntimeWarning: divide by zero encountered in double_scalars return np.cos(1 / x) Trapezoidal rule result for cos(1/x): nan Simpson's rule result for cos(1/x): nan N = 2, Integral = 1.0806046117362795 N = 2.0, Integral = nan Adaptive trapezoidal rule result for cos(1/x): nan
I have got these things in cos(1/x) function, Can you elaborate what it mean?
My graph for this function appears like this, is it correct?![image](https://github.com/ubsuny/23-Homework6G2/assets/143756553/08cd10bd-a0b0-4b2f-b7f1-10d2d580f40b)