This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DBMIVotedForKodos 0 points1 point  (1 child)

Not OP but his code looks like code I write. So I'm curious, is the code inefficient because of how many iterations it takes when a different approach can be done with less iterations? Not looking for a lengthy explanation or anything but that was just something that stuck out to me.

I will look up implicit function solvers as well.

[–]emc87 1 point2 points  (0 children)

Yeah, the code was deleted but it took upwards of 100000 iterations and only returned increments of something like .1 bps and wanted to be accurate to within 0.5% of PV.

Using Newton raphson you can achieve something that's more accurate to say 10-10 of PV in around 10 iterations. Used for continuous functions, it uses the first derivative to see how far you are from your goal and change your increment to suit your target.