Posts: 456
Threads: 63
Joined: Apr 2022
Reputation:
10
10-28-2022, 11:13 PM
(This post was last modified: 10-28-2022, 11:17 PM by PhilOfPerth.)
Firstly, I'm not dumb, I'm old and easily confused, so please try to keep any response simple and unencumbered.
I understand that 2^2 means 2*2, and 2^3 means 2*2*2. But I just can't get my head around 2^2.5 and similar. It's obviously not 2*2*half of 2, which is 2*2*1. Can someone explain (clearly) what the term means? My calculator tell me it's about 5.6568 but I can't see where this comes from.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Posts: 263
Threads: 14
Joined: Apr 2022
Reputation:
23
Raising a number to the ^ 2.5 is the same as raising a number to the ^5 and then taking the square root of that result. It's just a decimal representation of a rational number 5/2
Code: (Select All) a = 2 ^ 5
PRINT a
a = SQR(a)
PRINT a
b = 2 ^ 2.5
PRINT b
c = 2 ^ (5 / 2)
PRINT c
I've never done it, but I suppose there are uses.
That said, the fractional form is probably better for something like a cube root, which would be # ^ (1/3) which has an endlessly repeating decimal. It's best left to the machine to do it to its best ability rather than type .3333333333......
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 545
Threads: 116
Joined: Apr 2022
Reputation:
39
10-28-2022, 11:29 PM
(This post was last modified: 10-28-2022, 11:30 PM by James D Jarvis.)
It's the decimal expression of a fractional exponent.
2^2.5 is 2^(5/2) which = (sqr(2))^5
(oh darn, someone else beat me to the enter key. and did it better too)
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
10-28-2022, 11:30 PM
(This post was last modified: 10-28-2022, 11:32 PM by bplus.)
2 ^ 2.5 = sqr(2) ^ 5 that help?
Code: (Select All) Print Sqr(2) * Sqr(2) * Sqr(2) * Sqr(2) * Sqr(2)
hint 2.5 = 5/2 and 2 ^ .5 = 2 ^ (1/2) = sqr(2)
b = b + ...
Posts: 456
Threads: 63
Joined: Apr 2022
Reputation:
10
Ah, yes, thanks to all three of you. There's light at the end of the tunnel. A bit of my school-days math is coming back now, and I think I can go on from here.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
Well late to the party. I had to deal with just this sort of thing using string math on decimal powers and nth roots. It works well in theory with long division methods, but unlike string math regular division, which I made a very fast routine, the may iterations of decimal powers and nth roots with Pascal's Triangle and binomial expansion is a real speed killer. At some point, I need to take a good look at Jack's dec_float routines. He found some rounding method that seems like it might be reliable.
Pete
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
It's funny the 3 of us had answered all within a minute of each other, none of us knew the other was replying at same time.
We use to get an alert when someone has posted when we go to post our reply.
b = b + ...
Posts: 456
Threads: 63
Joined: Apr 2022
Reputation:
10
Actually, don't laugh, but I'm trying to re-invent (for my own use only) string math! I've got the easy ones (add, subtract, multiply, still sorting out division), then looked at powers, and came unstuck. I guess I'll get there, given time.
It started out when I read the story to my Grandkids about the king who offered a prize for slaying a dragon, and the winner asked for one grain of rice, doubled, for each square on a chess board. I wanted to find how many grains that would really be, but my computer exploded (not literally).
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Posts: 1,616
Threads: 157
Joined: Apr 2022
Reputation:
77
Funny, everyone at this forum has a degree in String Theory... except Bill!
Pete
Posts: 2,700
Threads: 124
Joined: Apr 2022
Reputation:
134
10-29-2022, 02:41 AM
(This post was last modified: 10-29-2022, 03:09 AM by bplus.)
Code: (Select All) _Title "Grains of Rice" ' b+ 2022-10-28
Dim x As _Unsigned _Integer64
$Console:Only
'_Font 8
x = 1
Print 1, x
For i = 2 To 64
x = x * 2
s$ = Str$(x)
Print i,
For j = 1 To Len(s$)
c$ = Mid$(s$, j, 1)
If c$ = "0" Then
Color 10
ElseIf s$ <> " " Then
Color Val(c$)
End If
Print c$;
Next
Print
Next
b = b + ...
|