If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby related euler constant question
5 posts
• Page 1 of 1
Ruby related euler constant question
Hi all, I was having trouble finding this answer from quora:
https://www.quora.com/Eulers-Constant-in-Ruby-code-and-how-to-translate-to-regular-math-without-algebra-for-DSP-code-Example-T-T-1000-mSec-alpha-1-Math-E-1-Fs-T-alpha-Math-E-1-Fs-T-output-alpha-end-T-234-361-nFS-48000-nA-0-999911
maybe someone here knows?
https://www.quora.com/Eulers-Constant-in-Ruby-code-and-how-to-translate-to-regular-math-without-algebra-for-DSP-code-Example-T-T-1000-mSec-alpha-1-Math-E-1-Fs-T-alpha-Math-E-1-Fs-T-output-alpha-end-T-234-361-nFS-48000-nA-0-999911
maybe someone here knows?
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
Re: Ruby related euler constant question
TBH, I have to agree with what Quora says - it's not at all clear what you're asking. You seem to want to know how to translate some algebra into code; but then, rather than providing an example of an algebraic formula that you're trying to translate, you provide some (broken?) code with no indication of what you expect it to do nor what you intend to use it for.
If you want a specific formula translating for a specific application, then you need to say what those are, and then we can try to help you. OTOH, if you want to know in general how Euler's constant is used, no answer is possible without using algebra - and when it's used in DSP equations, that usually means having to understand the maths of imaginary/complex numbers (it's a bit of a circular problem*, I realise, but unfortunately there's no avoiding that.)
(* Maths geek pun unintentional!)
If you want a specific formula translating for a specific application, then you need to say what those are, and then we can try to help you. OTOH, if you want to know in general how Euler's constant is used, no answer is possible without using algebra - and when it's used in DSP equations, that usually means having to understand the maths of imaginary/complex numbers (it's a bit of a circular problem*, I realise, but unfortunately there's no avoiding that.)
(* Maths geek pun unintentional!)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Ruby related euler constant question
Well, it only converts the numbers into a float using euler's. My real question is why it deviates.
Please check My limiter called esquire for a working example. It would seem that would be the best way of explaining:
http://dsprobotics.com/support/viewtopic.php?f=3&t=16533&p=52541&hilit=esquire#p52541
I was in a rush when posting, sorry. But You'll see what I am saying. I'll make some images etc so as to make it clearer if that is required.
Please check My limiter called esquire for a working example. It would seem that would be the best way of explaining:
http://dsprobotics.com/support/viewtopic.php?f=3&t=16533&p=52541&hilit=esquire#p52541
I was in a rush when posting, sorry. But You'll see what I am saying. I'll make some images etc so as to make it clearer if that is required.
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
Re: Ruby related euler constant question
Aah, yes I see now - not so bad then. It's just that the Quora code example looked very similar to one of the very common Euler equations which is much more complex* to explain mathematically.
If you're seeing a difference in value between Ruby and, say, the same calculation done with 'green' floats, it's probably just because of number precision. Ruby Float numbers are always 64-bit ("double-precision"), even in 32-bit versions of FlowStone, and Ruby might also use a different version of the function for raising to a power. Because of that, there will be slight differences in the result depending which method you use to do the calculation, because they will round-off the values differently. This can be a problem sometimes for very small numbers, because a small 64-bit number might get rounded down to zero (or a denormal number) when truncated to 32-bits - and zero is often a bit of a problem number for mathematical equations!
If you need to use Euler's constant in 'green' maths, you can just put its value into a 'float' box, but 32-bit green will always round it to roughly 6 significant digits in practice (2.71828).
(* Maths geek pun intended this time!)
If you're seeing a difference in value between Ruby and, say, the same calculation done with 'green' floats, it's probably just because of number precision. Ruby Float numbers are always 64-bit ("double-precision"), even in 32-bit versions of FlowStone, and Ruby might also use a different version of the function for raising to a power. Because of that, there will be slight differences in the result depending which method you use to do the calculation, because they will round-off the values differently. This can be a problem sometimes for very small numbers, because a small 64-bit number might get rounded down to zero (or a denormal number) when truncated to 32-bits - and zero is often a bit of a problem number for mathematical equations!
If you need to use Euler's constant in 'green' maths, you can just put its value into a 'float' box, but 32-bit green will always round it to roughly 6 significant digits in practice (2.71828).
(* Maths geek pun intended this time!)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Ruby related euler constant question
Yep, I just have to find a practical solution.
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 81 guests