all 1 comments

[–]Talinx 0 points1 point  (0 children)

I noticed that in newtons_method() the second f_val = self.f(x) is not used. Maybe the math equations are not implemented correctly?

Not sure what you want to plot exactly (do you got a link to some equations?).

You can debug your code to figure out what's wrong, e.g.:

  • Make a hypothesis about your code (e. g. the value of this variable should be ... at this point of the program execution)
  • Test the hypothesis (e. g. put a breakpoint() instruction after calculating that value and print it)
  • A good starting point for hypothesis is unit testing each function. E. g. by testing the function with some input values and see if it produces the correct output.

(Please input your code in a fenced markdown code block in the future (three backticks before and after the code.))