ubsuny / 23-Homework6G3

This is the main repository for 23-Homework6G3 involving calculus.
https://github.com/ubsuny/23-Homework6G3
Apache License 2.0
0 stars 7 forks source link

Task 2 - root_simple unable to find root for tanh(x) #35

Closed WildJimmy closed 8 months ago

WildJimmy commented 8 months ago

I'm having some issues with task 2. I can't get root_simple to find the roots of tanh(x) when given a positive initial guess. It will always exceed the maximum number of steps. However, for negative guesses it is fine. Any ideas on how to resolve this without changing the algorithm? I'm a little confused because tan and tanh have roughly the same behavior around x = 0 and I do not have this issue with finding the roots of tan

s4il3sh commented 8 months ago

@WildJimmy We don't have to find the exact root. The precise value for tanh(x) is okay. All we need to find out is how many digits the values are accurate. I chose 1 and -1 both of them gave the same magnitude but opposite signs. Comparing them and choosing the best value close to zero. I guess that way we can work out. Have you tried the root_secant function?

Pranjal-Srivastava-2023 commented 8 months ago

@s4il3sh can you share the plots?

AhmedCode99 commented 8 months ago

Good luck, let me know if you need help

Pranjal-Srivastava-2023 commented 8 months ago

@s4il3sh The deadline is today at 2 pm. Please let us know if you need help.

reshnashrestha commented 8 months ago

I just merged his work.