Roots and powers playing nicely together... - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2) +--- Thread: Roots and powers playing nicely together... (/showthread.php?tid=929) |
RE: Roots and powers playing nicely together... - Pete - 09-30-2022 Well I consider myself a math-e-mortician. A place where numbers come to die! I'll have a look as soon as I clean up this existing code. Pete RE: Roots and powers playing nicely together... - bplus - 10-01-2022 In a nutshell, for power take the natural log (Ln) of x ^ y = y * ln(x) and convert it back with e^(y*ln(x)). Just need good algorithms to do the calculations. RE: Roots and powers playing nicely together... - Pete - 10-01-2022 For string math, I would have to write a way to do natural logs by an existing string math process. That's why I avoided this method. Well, let's have a look at a small numeric piece of code... Code: (Select All) PRINT Log10(64) So the question would be when does the numeric log function crap out and where is the point where the accuracy is in question? It is usually the last digit but rounding errors can make a mess of that, too. Pete RE: Roots and powers playing nicely together... - Kernelpanic - 10-01-2022 Don't get the problem - not really. When does it become inaccurate? -- I still have to practice with Locate so that the columns are next to each other. Input 10,000 results in: 4.0000 Code: (Select All) 'Logarithmusuebung. Wann Programmabsturz? - 1. Okt. 2022 RE: Roots and powers playing nicely together... - bplus - 10-01-2022 I got it working but like doing Powers with Binary of nested Square Roots of 2, it takes a long time with not very accurate results. The main problem is removing non significant digits in calculations to get square root of 4 done in this century. RE: Roots and powers playing nicely together... - Kernelpanic - 10-01-2022 (10-01-2022, 03:51 PM)bplus Wrote: I got it working but like doing Powers with Binary of nested Square Roots of 2, it takes a long time with not very accurate results. The main problem is removing non significant digits in calculations to get square root of 4 done in this century. One still have 78 years to do that. Just don't rush! RE: Roots and powers playing nicely together... - Pete - 10-01-2022 Speaking of 78 years... I got to thinking last night about how much faster factoring is when you can go from 500 binomial iterations where the numbers get hundreds of digits long to just 5 iterations by 10 root 8 = x 10 root x = x 5 root x = answer. Now the problem is large PRIME numbers. You can't factor those down. When you get like or higher than 503 root whatever, you are back to going away the morning to wait for you result. I don't know if there are any other equation manipulations that could be made to always reduce the radicand under 500 and preserve the answer. Anyone know of a method? As far as the log method. I did try out that function I posted with some very large string numbers. It did return values that did not fall apart, but I have not found a high precision log calculator to check them for accuracy. I know next to nothing about log functions. I think natural logs is base 10, so it is surprising to me a base 10 operation in computer math isn't noticeably falling apart. I need to do more research. Mark, the significant figures rabbit hole can be avoided with long division nth root routines, but speed is still an issue with radicands in the hundreds+. Lookup tables are the way around that, but to what limit? 1000? 10,000? Could you imagine having to fill up a program with 90,000 indexed strings, many hundreds of digits long? Pete RE: Roots and powers playing nicely together... - bplus - 10-01-2022 @Pete I will post current status of my String Math for estimating natural logs (base e, compared to log 10 base 10) and string math routine for calc e^x basically x^y = e ^(y * ln(x)) see WIP board lots of tweaking still needed but ShowDP is coming in real handy for reducing digits. QB64 Log(x) is for natural logarithms base e, that is big player in calculus classes, because integrals and derivatives are pretty easy like polynomials. RE: Roots and powers playing nicely together... - Kernelpanic - 10-01-2022 Pete, what you gave as an example is an Excel function. Or am I wrong? "You can use the Excel LOG10 function to find the base 10 logarithm of a number. For example, =LOG10(100) returns 2 and =LOG10(1000) returns 3." - That is correct. Oh, now I can't see through it anymore. This is mayhem! And this is the result with the Log-Function in QBasic64: Code: (Select All) 'Logarithmusuebung mit "Log" - 1. Okt. 2022 |