09-23-2022, 03:35 PM
(09-23-2022, 01:53 PM)Kernelpanic Wrote: I do not understand your problem. Why about the extensions of the binomial theorem? You can easily calculate the cube root with the now well-known formula. Or am I misunderstanding the question?
Code: (Select All)Dim As Double n, x, rootx
Input "Wurzelexponent: ", n
Input "Radikand : ", x
rootx = x ^ (1 / n)
Print Using "Kubikwurzel: ###.##########"; rootx
It's great for limited digit numeric math, but I couldn't use it for string math because the only algorithm I was able to convert to handle the decimal roots needed by that algorithm was done with approximation decimal form, and in string math that leads to rounding errors. In string math, you need to work with fractions so 1/3 is really 1/3 and not .333.
For example: Take the cube root of 125. Simple, 5, right? Well, let's look at the equation in terms of string math when decimal powers are encountered an calculated by approximation with Newton's work:
125 ^ (1 / 3) is "125"^ ".333..."
125^.333... in string math = 4.996 to three digits, not 5. Now since string math can easily handle a 1,000+ digits, the accuracy problem with larger numbers would be immense. Let's say, and I'll just make up a number for this: 4.9665242234315151119541094114141414143678 and it is supposed to be 5. So if we cube it it falls just short of 125. Now because there are so many digits, it would take several iterations to correct it by approximation. So two processes would be needed, and the latter one would be lengthy. This would really slow up computations of 200+ digit numbers coupled with very large nth roots.
Pete