ubsuny / 23-Homework6G4

Apache License 2.0
0 stars 11 forks source link

Iteration steps=0 for Efficiency #28

Closed Mosaddeq107 closed 10 months ago

Mosaddeq107 commented 10 months ago

Hi, all, I am getting this kind of output for the task 2 below:

Efficiency = 0 steps

What might be the possible cause for this bug?

pratibha77118 commented 10 months ago

@Mosaddeq107 I am trying to use the same but havenot completed yet. I am on the part to remove singularity for the functions given.

pratibha77118 commented 10 months ago

@Mosaddeq107 Are we supposed to find iteration steps for all three methods?

WildJimmy commented 10 months ago

When you are finding the root, is your initial guess at the actual root itself? For example, the root_simple function takes arguments like

root_simple(function, initial_guess, step_size)

So if your second argument is 0 (an exact root for tan, tanh), your algorithm will immediately find the proper root and not have to iterate. I tackled this by using a random starting guess between -2 and 2 which is used for both algorithms when they are compared

Mosaddeq107 commented 10 months ago

When you are finding the root, is your initial guess at the actual root itself? For example, the root_simple function takes arguments like

root_simple(function, initial_guess, step_size)

So if your second argument is 0 (an exact root for tan, tanh), your algorithm will immediately find the proper root and not have to iterate. I tackled this by using a random starting guess between -2 and 2 which is used for both algorithms when they are compared

Ow... Nice finding. How was the number of iterations whenever you applied this technique? @WildJimmy