Any math experts know what I'm missing here? [Solved]
|
09-23-2022, 01:37 PM
What's up with every line being in its own code block, Pete?
Ask me about Windows API and maybe some Linux stuff
09-23-2022, 01:53 PM
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
09-23-2022, 01:57 PM
For Spriggsy:
Code: (Select All) $Console:Only Don't know why Pete didn't fix it himself, too tired? Quote: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? I think Pete is looking for a routine to do roots he can translate to string math. I don't get the Binomial Theorem reference either but the code does get the first digits of 10^.3333... and some other like n = 5 or 27 or .027 or 125 (but not 125^3) but no decimal placements.
b = b + ...
09-23-2022, 03:02 PM
I think I either pranked myself or Steve is feeling better and did it for me! Individual code boxes. I sure as hell didn't stay up all night making those. Weird. Fixed now.
Hey guys, binomial expansion as in, if you've ever prayed for death: https://www.youtube.com/watch?v=RD_Ybm86fu8 Your prayers got answered! Easier read: https://www.wikihow.com/Calculate-Cube-Root-by-Hand Okay, so the binomial expansion works for cubes, but as written won't do anything but cubes when I change the root variable to say 2, 4, or 5. So either I goofed up something in the algorithm, and amazingly it still works for cubes, or there is some more complicated factorials that need to be considered with other nth roots that i haven't figured out and applied. In regard to decimal point, I have not bothered with that part yet. Just trying to get the digits for now, but mainly I'm looking for a long division (instead of approximation) process for nth roots (meaning all roots like squares, cubes, 4ths, 5ths...). Pete
If eggs are brain food, Biden takes his scrambled.
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? 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
09-23-2022, 05:02 PM
Okay, it appears after a bit more research the binominal expansion is written correctly, but only for cubes. As one of my hunches should prove out that algorithm needs to be expanded upon for larger nth roots, so just plugging in the higher roots to the existing formula is a fail.
Pete
If eggs are brain food, Biden takes his scrambled.
09-23-2022, 05:17 PM
I've had extra tags appear after too many edits, but nothing on that scale!
Can't entirely rule out the had of Steve, tho.
09-23-2022, 06:29 PM
Yeah, I have no idea if I did something out of the ordinary to cause that line by line code fiasco. Hope to never see it again. Hell of a thing to wake up to.
Well in better news, I've got a good handle on an iterative formula working with square roots and cube roots in a test phase. I need to add the part where the remainder is brought down, according to the nth root size, to finish it. Pete
If eggs are brain food, Biden takes his scrambled.
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 4 Guest(s)