Author Topic: Power function  (Read 9420 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Power function
« on: July 24, 2018, 01:16:16 am »
For the math fans, I stumbled upon a way to do power function that might be interesting:
Code: QB64: [Select]
  1. _TITLE "Power Function by bplus"
  2. 'QB64 X 64 version 1.2 20180228/86  from git b301f92
  3.  
  4. ' started 2018-07-23  Naalaa has no power function (or operator), so I wrote a power function for it.
  5. ' ''Power pack the short version.txt
  6. ' ''written for Naalaa 6 by bplus posted 2018-07-23
  7. ' ''extracted from large test of fractions, random number functions, string... in Power test.txt
  8.  
  9. ' OMG the crazy thing worked! It produced decent estimates of roots given the limitations of precision...
  10. ' Now I want to see how well it works with far greater precision available. So here we are, looking to see
  11. ' how this function compares to the regualar ^ operator in QB64.
  12.  
  13. 'from Naalaa comments:
  14. ' The main purpose of this code: to demo a power function for real numbers,
  15.  
  16. ' I had an idea for how real numbers to the power of real numbers might be done ie x ^ y = ?
  17. ' This means that not only can you take SQR of a number, you can get cube or cube root, quartic, 5th 6th... roots and any multiple
  18.  
  19. ' It came from this simple idea
  20. ' 2 ^ 3.5 = 2 ^ 3 * 2 ^ .5 = 8 * Sqr(2)
  21. ' 3 ^ 3.5 = 3 ^ 3 * 3 ^ .5 = 27 * Sqr(3)
  22.  
  23. ' so 2 ^ 3.25 = 2 ^ 3 * 2 ^ .25
  24. ' what is 2 ^ .25 ?  It is sqr(sqr(2)) !
  25.  
  26. ' likewise 2 ^ 3.125 = 2 ^ 3 * 2 ^ 1/8
  27. ' what is 2 ^ 1/8 ? It is sqr(sqr(sqr(2))) !
  28.  
  29. ' any decimal can be written as a sum of fraction powers of 2 ie 1/2^n, as any integer can be written in powers of 2.
  30. ' in binary expansions
  31. ' 1/2 = .1       or .5 base 10
  32. ' 1/4 = .01      or .25 base 10
  33. ' 1/8 = .001     or .125 base 10
  34. ' 1/16 = .0001   or .0625 base 10
  35.  
  36. ' So with binary expansion of decimal, we can SQR and multiply our way to an estimate
  37. ' of any real number to the power of another real number using binary expansion of
  38. ' the decimal parts as long as we stay in Naalaa integer limits and are mindful of precision.
  39.  
  40. CONST wW = 800
  41. CONST wH = 600
  42. SCREEN _NEWIMAGE(wW, wH, 32)
  43. _SCREENMOVE 360, 60
  44.  
  45.     PRINT "Testing the power(x, pow) function:"
  46.     INPUT "(nothing) quits, Please enter a real number to raise to some power. x = "; x
  47.     IF x = 0 THEN EXIT DO
  48.     INPUT "(nothing) quits, Please enter a real number for the power. pow = ", pw
  49.     IF pw = 0 THEN EXIT DO
  50.     result = power(x, pw)
  51.     PRINT result; " is what we estimate for"; x; " raised to power of"; pw
  52.     PRINT x ^ pw; " is what the ^ operator gives us."
  53.     PRINT
  54. PRINT "This is matching the ^ operator very well! This code is clear proof of concept!"
  55. PRINT " OMG, it worked!!!"
  56.  
  57.  
  58. ' A power function for real numbers (small ones but still!)
  59. ' x to the power of pow
  60. FUNCTION power## (x AS _FLOAT, pow AS _FLOAT)
  61.     'this sub needs 2 other subs
  62.     'bExpand20$
  63.     'split though for this split is overkill
  64.     DIM build AS _FLOAT
  65.     REDIM s(0) AS STRING
  66.     r$ = "0" + STR$(pow) 'in case pow starts with decimal
  67.     Split s$(), r$, "."
  68.     integer$ = s$(0)
  69.     build = 1.0
  70.     IF integer$ <> "0" THEN
  71.         p = VAL(integer$)
  72.         FOR i = 1 TO p
  73.             build = build * x
  74.         NEXT
  75.     END IF
  76.     IF UBOUND(s$) = 0 THEN power = build: EXIT SUB
  77.     'that takes care of integer part,
  78.     'now for the fraction part convert decimal to fraction
  79.     n$ = s$(1)
  80.     ld = LEN(n$)
  81.     WHILE RIGHT$(n$, 1) = "0"
  82.         n$ = LEFT$(n$, ld - 1)
  83.         ld = LEN(n$)
  84.     WEND
  85.     denom& = 10
  86.     FOR i = 2 TO ld
  87.         denom& = denom& * 10
  88.     NEXT
  89.     numer& = VAL(n$)
  90.     'OK for bExpand20$ don't have to simplify and that saves us having to extract n and d again from n/d
  91.     bs$ = bExpand60$(numer&, denom&)
  92.     'at moment we haven't taken any sqr of x
  93.     runningXSQR = x
  94.     'run through all the 0's and 1's in the bianry expansion of the fraction part of the power float
  95.     FOR i = 1 TO LEN(bs$)
  96.         'this is the matching sqr of the sqr of the sqr... of x
  97.         runningXSQR = SQR(runningXSQR)
  98.         'for every 1 in the expansion, multiple our build with the running sqr of ... sqr of x
  99.         IF MID$(bs$, i, 1) = "1" THEN build = build * runningXSQR
  100.     NEXT
  101.     'our build should be a estimate or x to power of pow
  102.     power = build
  103.  
  104. 'write a series of 1s and 0s that represent the decimal fraction n/d in binary 60 places long
  105. FUNCTION bExpand60$ (nOver&, d&)
  106.     DIM b AS _FLOAT, r AS _FLOAT
  107.     ' b for base
  108.     b = 0.5
  109.     ' r for remainder
  110.     r = nOver& / d&
  111.     ' s for string$ 0's and 1's that we will build and return for function value
  112.     s$ = ""
  113.     ' f for flag to stop
  114.     f% = 0
  115.     ' c for count to track how far we are, don't want to go past 20
  116.     c% = 0
  117.     WHILE f% = 0
  118.         IF r < b THEN
  119.             s$ = s$ + "0"
  120.         ELSE
  121.             s$ = s$ + "1"
  122.             IF r > b THEN
  123.                 r = r - b
  124.             ELSE
  125.                 f% = 1
  126.             END IF
  127.         END IF
  128.         c% = c% + 1
  129.         IF c% >= 60 THEN f% = 1
  130.         b = b * 0.5
  131.     WEND
  132.     bExpand60$ = s$
  133.  
  134. SUB Split (arr() AS STRING, mystr AS STRING, delim AS STRING)
  135.     DIM c AS STRING * 1, curpos AS LONG, arrpos AS LONG, le AS LONG
  136.     curpos = 1: arrpos = 0
  137.     le = LEN(mystr)
  138.     DO UNTIL (curpos > le)
  139.         c = MID$(mystr, curpos, 1) ' Get 1 ctr
  140.         IF (c <> delim) THEN
  141.             arr(arrpos) = arr(arrpos) + c
  142.         ELSE
  143.             arrpos = arrpos + 1
  144.             REDIM _PRESERVE arr(arrpos + 1) AS STRING 'AS STRING required or it assumes the default type which is SINGLE
  145.         END IF
  146.         curpos = curpos + 1
  147.     LOOP
  148.     REDIM _PRESERVE arr(arrpos) AS STRING
  149.  
« Last Edit: July 24, 2018, 01:22:57 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #1 on: July 24, 2018, 08:19:43 am »
Update Naalaa does have a pow#(x#, y#) function, just not documented (nor keyword highlighted).

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #2 on: July 24, 2018, 11:30:25 am »
I have replaced split with two new (for my toolbox) very handy string functions, leftOf$ and rightOf$.

Like [banned user], constantly working on ever better code.

Code: QB64: [Select]
  1. _TITLE "Power Function 2 by bplus"
  2. 'QB64 X 64 version 1.2 20180228/86  from git b301f92
  3.  
  4. ' started 2018-07-23  Naalaa has no power function (or operator), so I wrote a power function for it.
  5. ' ''Power pack the short version.txt
  6. ' ''written for Naalaa 6 by bplus posted 2018-07-23
  7. ' ''extracted from large test of fractions, random number functions, string... in Power test.txt
  8. ' 2018-07-24 Power Function 2 split is replaced with two much smaller and very handy string functions.
  9.  
  10. ' OMG the crazy thing worked! It produced decent estimates of roots given the limitations of precision...
  11. ' Now I want to see how well it works with far greater precision available. So here we are, looking to see
  12. ' how this function compares to the regualar ^ operator in QB64.
  13.  
  14. 'from Naalaa comments:
  15. ' The main purpose of this code: to demo a power function for real numbers,
  16.  
  17. ' I had an idea for how real numbers to the power of real numbers might be done ie x ^ y = ?
  18. ' This means that not only can you take SQR of a number, you can get cube or cube root, quartic, 5th 6th... roots and any multiple
  19.  
  20. ' It came from this simple idea
  21. ' 2 ^ 3.5 = 2 ^ 3 * 2 ^ .5 = 8 * Sqr(2)
  22. ' 3 ^ 3.5 = 3 ^ 3 * 3 ^ .5 = 27 * Sqr(3)
  23.  
  24. ' so 2 ^ 3.25 = 2 ^ 3 * 2 ^ .25
  25. ' what is 2 ^ .25 ?  It is sqr(sqr(2)) !
  26.  
  27. ' likewise 2 ^ 3.125 = 2 ^ 3 * 2 ^ 1/8
  28. ' what is 2 ^ 1/8 ? It is sqr(sqr(sqr(2))) !
  29.  
  30. ' any decimal can be written as a sum of fraction powers of 2 ie 1/2^n, as any integer can be written in powers of 2.
  31. ' in binary expansions
  32. ' 1/2 = .1       or .5 base 10
  33. ' 1/4 = .01      or .25 base 10
  34. ' 1/8 = .001     or .125 base 10
  35. ' 1/16 = .0001   or .0625 base 10
  36.  
  37. ' So with binary expansion of decimal, we can SQR and multiply our way to an estimate
  38. ' of any real number to the power of another real number using binary expansion of
  39. ' the decimal parts as long as we stay in Naalaa integer limits and are mindful of precision.
  40.  
  41. CONST wW = 800
  42. CONST wH = 600
  43. SCREEN _NEWIMAGE(wW, wH, 32)
  44. _SCREENMOVE 360, 60
  45.  
  46.     PRINT "Testing the power(x, pow) function:"
  47.     INPUT "(nothing) quits, Please enter a real number to raise to some power. x = "; x
  48.     IF x = 0 THEN EXIT DO
  49.     INPUT "(nothing) quits, Please enter a real number for the power. pow = ", pw
  50.     IF pw = 0 THEN EXIT DO
  51.     result = power(x, pw)
  52.     PRINT result; " is what we estimate for"; x; " raised to power of"; pw
  53.     PRINT x ^ pw; " is what the ^ operator gives us."
  54.     PRINT
  55. PRINT "This is matching the ^ operator very well! This code is clear proof of concept!"
  56. PRINT " OMG, it worked!!!"
  57.  
  58.  
  59. ' A power function for real numbers (small ones but still!)
  60. ' x to the power of pow
  61. FUNCTION power## (x AS _FLOAT, pow AS _FLOAT)
  62.     'this sub needs: bExpand60$, leftOf$, rightOf$
  63.  
  64.     DIM build AS _FLOAT
  65.     r$ = "0" + STR$(pow) 'in case pow starts with decimal
  66.     integer$ = leftOf$(r$, ".")
  67.     build = 1.0
  68.     IF integer$ <> "0" THEN
  69.         p = VAL(integer$)
  70.         FOR i = 1 TO p
  71.             build = build * x
  72.         NEXT
  73.     END IF
  74.     'that takes care of integer part
  75.  
  76.     n$ = rightOf$(r$, ".")
  77.     IF n$ = "" THEN power = build: EXIT SUB
  78.  
  79.     'remove 0's to right of main digits
  80.     ld = LEN(n$)
  81.     WHILE RIGHT$(n$, 1) = "0"
  82.         n$ = LEFT$(n$, ld - 1)
  83.         ld = LEN(n$)
  84.     WEND
  85.  
  86.     'note: we are pretending that the ^ operator is not available, so this is hand made integer power
  87.     denom& = 10
  88.     FOR i = 2 TO ld
  89.         denom& = denom& * 10
  90.     NEXT
  91.  
  92.     'OK for bExpand60$ don't have to simplify fraction and that saves us having to extract n and d again from n/d
  93.     bs$ = bExpand60$(VAL(n$), denom&)
  94.  
  95.     'at moment we haven't taken any sqr of x
  96.     runningXSQR = x
  97.  
  98.     'run through all the 0's and 1's in the bianry expansion, bs$, the fraction part of the power float
  99.     FOR i = 1 TO LEN(bs$)
  100.         'this is the matching sqr of the sqr of the sqr... of x
  101.         runningXSQR = SQR(runningXSQR)
  102.         'for every 1 in the expansion, multiple our build with the running sqr of ... sqr of x
  103.         IF MID$(bs$, i, 1) = "1" THEN build = build * runningXSQR
  104.     NEXT
  105.  
  106.     'our build should now be an estimate or x to power of pow
  107.     power = build
  108.  
  109. 'write a series of 1s and 0s that represent the decimal fraction n/d in binary 60 places long
  110. FUNCTION bExpand60$ (nOver&, d&)
  111.     DIM b AS _FLOAT, r AS _FLOAT
  112.     ' b for base
  113.     b = 0.5
  114.     ' r for remainder
  115.     r = nOver& / d&
  116.     ' s for string$ 0's and 1's that we will build and return for function value
  117.     s$ = ""
  118.     ' f for flag to stop
  119.     f% = 0
  120.     ' c for count to track how far we are, don't want to go past 20
  121.     c% = 0
  122.     WHILE f% = 0
  123.         IF r < b THEN
  124.             s$ = s$ + "0"
  125.         ELSE
  126.             s$ = s$ + "1"
  127.             IF r > b THEN
  128.                 r = r - b
  129.             ELSE
  130.                 f% = 1
  131.             END IF
  132.         END IF
  133.         c% = c% + 1
  134.         IF c% >= 60 THEN f% = 1
  135.         b = b * 0.5
  136.     WEND
  137.     bExpand60$ = s$
  138.  
  139. FUNCTION leftOf$ (source$, of$)
  140.     posOf = INSTR(source$, of$)
  141.     IF posOf > 0 THEN leftOf$ = MID$(source$, 1, posOf - 1)
  142.  
  143. FUNCTION rightOf$ (source$, of$)
  144.     posOf = INSTR(source$, of$)
  145.     IF posOf > 0 THEN rightOf$ = MID$(source$, posOf + LEN(of$))
  146.  

I have plans for these 2 stringy's, possible for generic properties  keyword = value, or more decimal work or work with fractions with notations _ dividing integer part with fraction part and / dividing numerator and denominator. Let's see what else...?

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Power function
« Reply #3 on: July 24, 2018, 12:02:40 pm »
Hi bplus! I like it.
However, I can do same thing in just 5 lines of function.

Code: QB64: [Select]
  1. FUNCTION power2## (x AS _FLOAT, pow AS _FLOAT)
  2.     DIM y AS _FLOAT
  3.     y = _CEIL(pow)
  4.     IF y = pow THEN power2## = x ^ y ELSE power2## = (x ^ (y - 1)) * (x ^ (pow - (y - 1)))
  5.  

EDIT:
Oh! I noticed, You didn't use even a single '^' in your function. That's the reason you are using string functions.
Amazing!
« Last Edit: July 24, 2018, 12:05:59 pm by Ashish »
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #4 on: July 24, 2018, 12:09:11 pm »
Yes, Ashish but are you missing the point?

Can you do it without using ^?

That is the challenge!

I mean someone had to figure out how to code the ^ operator.

I just did yesterday and am pretty impressed with myself! ;D

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #5 on: July 24, 2018, 12:12:08 pm »
Hi bplus! I like it.
However, I can do same thing in just 5 lines of function.

Code: QB64: [Select]
  1. FUNCTION power2## (x AS _FLOAT, pow AS _FLOAT)
  2.     DIM y AS _FLOAT
  3.     y = _CEIL(pow)
  4.     IF y = pow THEN power2## = x ^ y ELSE power2## = (x ^ (y - 1)) * (x ^ (pow - (y - 1)))
  5.  

EDIT:
Oh! I noticed, You didn't use even a single '^' in your function. That's the reason you are using string functions.
Amazing!

OK now you get it! (maybe starting to anyway) ;)

Hey why did you use _CEIL? Wouldn't that turn it to integer and miss out doing roots?
« Last Edit: July 24, 2018, 12:15:23 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #6 on: July 24, 2018, 12:26:58 pm »
Math lesson:

If x ^ 7 = 1000 what does x = ?

x = 1000 ^ (1/7)

if x ^ 3 = 343 what does x = ?

x = 343 ^ (1/3) the cube root of 343 which is 7 if my multiplying was correct.
x = 343 ^ (.33333...) same thing

Did you know?  SQR(n) = n ^ .5

EDIT: my multiplication was incorrect, sorry 7 ^ 3 <> 483
« Last Edit: July 24, 2018, 12:35:16 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #7 on: July 24, 2018, 07:30:24 pm »
Code: QB64: [Select]
  1. _TITLE "Tower of power and Circle of power by bplus"
  2. 'started 2018-07-24 bplus
  3. 'using QB64 X 64 version 1.2 20180228/86  from git b301f92
  4. CONST wW = 800
  5. CONST wH = 600
  6. pi = _PI
  7. SCREEN _NEWIMAGE(wW, wH, 32)
  8. _SCREENMOVE 360, 60
  9.  
  10. ' if x ^ 7 = wH, what does x = ?
  11. x = wH ^ (1 / 7)
  12. 'so if I multiply x times itself 7 times I will go the height of this screen
  13. cx = wW / 2
  14. FOR power = 50 TO 1 STEP -1
  15.     CLS
  16.     LOCATE 1, 1: PRINT power
  17.     x = (wH - 20) ^ (1 / power)
  18.     FOR i = 0 TO power - 1
  19.         LINE (cx - .5 * x ^ i, 10 + x ^ i)-(cx + .5 * x ^ i, 10 + x ^ (i + 1)), , B
  20.     NEXT
  21.     _DISPLAY
  22.     _LIMIT 10
  23. _DELAY .03
  24. cy = wH / 2
  25. 'dividing the radius a number of times...
  26. FOR power = 50 TO 1 STEP -1
  27.     CLS
  28.     LOCATE 1, 1: PRINT power
  29.     x = (wH - 20) ^ (1 / power)
  30.     FOR i = 1 TO power
  31.         CIRCLE (cx, cy), .5 * (wH - 20 - x ^ i)
  32.     NEXT
  33.     _DISPLAY
  34.     _LIMIT 10
  35.  
  36.  
« Last Edit: July 24, 2018, 07:32:33 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Power function
« Reply #8 on: July 24, 2018, 08:30:07 pm »
Well... You just destroyed my right retina and the left one took a heavy beating... I hope you're happy!! Nah. Kidding. Great job!

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #9 on: July 25, 2018, 11:02:12 am »
Ha! burning retinas was not my intension, this time. ;)

I was hoping to illustrate a possible use of power for drawing. Maybe I should keep looking... :)

I did have an idea for planting trees with the rows getting ever closer and the trees ever smaller as they approached the horizon line.

Perhaps an army of space aliens instead of trees would be more dramatic, or rats maybe!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Power function
« Reply #10 on: July 26, 2018, 12:59:00 pm »
I like it bplus. Unfortunately I'm not near a QB64-enabled machine for a little while and thus didn't give it an explicit test run - so forgive my ignorance if you've answered this/these:

Can this method extend to very high precision numbers, like 2.7189876543212345678998765432123456789  ^ 3.1498765432345678998765432123456789 ?

And

By a similar-sounding but entirely different token, can it handle very large powers, like 999 ^ 999?
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #11 on: July 26, 2018, 05:48:28 pm »
Hi STxAxTIC,

The QB64 code would fail as soon as STR$(the power) starts including letters D or E or whatever for scientific notation.
Code: QB64: [Select]
  1. r$ = "0" + STR$(pow) 'in case pow starts with decimal
That would be the first thing (in code sequence) to fail, the next would be _FLOAT's precision.

I am sure the method would be possible for string math with arbitrary long decimal or binary expressions and sqr but without practical need I don't know if want to do all that work.
« Last Edit: July 26, 2018, 05:56:56 pm by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Power function
« Reply #12 on: July 26, 2018, 09:47:52 pm »
Heya bplus,

Thanks for the swift answer. Your post inspired me to waste 20 minutes fiddling with trigonometric expansions of real numbers. It happened to be a total waste of paper and ink, but hardly a waste of time. Say, want any of your polished work(s) to be immortalized in Samples? It wouldn't bother Odin a bit.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Power function
« Reply #13 on: July 26, 2018, 11:25:23 pm »
Hi STxAxTIC,

Sure Odin may use what please's them.

Can you tell I am particularly pleased with this little gem despite it's limits?

I searched for a Taylor expansion but could find no direct method for powers. I suppose one might be worked out from log and e... but then I found this little clue about 2 ^ 3.5 and got the insight.

I had played around with binary expansion of fractions for years, awed by how patterns of 1's and 0' for rational numbers interweave for instance patterns for n/15 include same patterns for n/3 and n/5 (of course, because they reduce to the same thing but I got to see it played out in graphic diagrams white boxes for 1 and black boxes for 0 a beautiful flow of patterns).
« Last Edit: July 26, 2018, 11:28:45 pm by bplus »

Marked as best answer by bplus on August 02, 2018, 07:09:56 am

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Power function
« Reply #14 on: July 28, 2018, 09:28:14 am »
Hm, for applying Taylor series, first thing that comes to mind is logs and exponentials, exactly like you said. For those who aren't convinced, it goes like this:

i) Suppose we want to compute A = X^Y without explicitly doing the X^Y part.
ii) Take the log of both sides to get: ln A = Y ln X
iii) Exponentiate to land at: A = exp(Y ln X)

... and realize the answer is one Taylor series embedded in another. There are a handful of expansions for ln X in terms of infinite series, but of course these do involve doing integer powers ^2, ^3, ^4, etc. (Easily reduced to trivial multiplication, but you still may accuse me of chicken-and-egging the problem a little bit). Finally, the exp() series is the famous 1 + x + x^2/2 etc.
« Last Edit: July 28, 2018, 09:30:44 am by STxAxTIC »
You're not done when it works, you're done when it's right.