Math help is this possible?
Dgswaner
Posts: 795
Is there a way to do this equation on a propeller? 27.5*(1.0594630943593^x) Yes I do need that many decimal places. Before X get very big the difference adds up enough to matter. I only need the answer to be to the 2nd decimal though.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
Post Edited (Dgswaner) : 1/14/2008 11:45:11 PM GMT
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
Post Edited (Dgswaner) : 1/14/2008 11:45:11 PM GMT
Comments
The standard floating point imlementation (32 bit) however uses 7 digits only (= 1.059463)
The accuracy also depends on what X should be. A small integer? A large integer? A floating point number?
In the latter case the accuracy of the result will be likewise influenced by the accuracy of that exponent...
Even worse, in that case there is hardly any other possiblility but to use the log/antilog tables for the exponentiation, which will determe the quality of the results eventually.
If X be an integer you could easily extend the floating point algorithm to "double precision" which will be the 16 digits you are requesting.
Post Edited (deSilva) : 1/15/2008 1:22:18 AM GMT
As you only need 2 decimal places you may be able to do it with a table of say 100 or less entries - maybe much less depending on the actual requirements.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If so, perhaps you can start with a High common denominator and first divide out the top octave,
which then can be divided by 2's by counters to get all the lower octaves, with mostly integer math.
Some of the divisions will have remainders.
"If necessary", just divide your remainders by your divisors to include the fraction.
As I wrote above:
N=2_002_400 Hz (THE common denominator frequency)
C=N/478 (high octave frequencies: )
C#=N/451
D=N/436
D#=N/402
E=N/379
F=N/358
G=N/338
G#=N/319
A=N/301
A#=N/284
B=N/268
B#=n/253
C=N/239 ... or C=C/2 or C=C/4 or C=C/8 or C=C/16 for lower octave's
- thus counting in binary does all octave divisions for all "C" notes (for example) at once.
I think a Moog instrument used that technique and that integer common denominator frequency.
It should be very accurate and stable.
I was trying to get away from a 88 statement long case statement but it might be what happens. if that formula would work it would only take a small object file (with the frequency synth object) to do a 88 note synthesizer. 1-88 would be the keys from left to right.
This would make it really easy to write songs with the propeller.
the decimal place doesn't become a factor until about ^15+ that's more than an octave so perhaps the formula could be adjusted per octave. rather than start with 27.5 you could start somewhere else in the sequence and the drift wouldn't be noticeable. but I was hoping not to get a work around.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
-Phil
to show...
352000 ' A7 3520.00 Hz
332244
313596
295996
279383
263702
248902
234932
221746
209300
197553
186465
176000 A6 1760.00 Hz
... etc.
4120
3889
3671
3465
3270
3087
2913
2750 A0 27.5 Hz
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
This is over my head a bit but I am trying to learn so if you would bear with me I would appreciate it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
eg: 12 = %1100 if you shift every bit to the right, once, then you get: 6 = %110, where the right most digit just goes away.
Shift left is multiply by two.
Your base table then equals one octave, and the number of shifts relate to other octaves, and the divide necessary to derive the value from the base table.
Think of it the same way you do the zero in ordinary decimal math. If you've got 1200, and you shift right, the right most digit goes away, leaving 120, which is a divide by 10.
And a shift left, in decimal, would be a multiply by 10.
Each octave equals one shift then, with multipliers being, 2, 4, 8, etc... Same for divisors, depending on what you need to do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
Post Edited (Dgswaner) : 1/15/2008 6:21:15 PM GMT
Who cares about slow. It's about fun!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!