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 premade modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
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/EulersConstantinRubycodeandhowtotranslatetoregularmathwithoutalgebraforDSPcodeExampleTT1000mSecalpha1MathE1FsTalphaMathE1FsToutputalphaendT234361nFS48000nA0999911
maybe someone here knows?
https://www.quora.com/EulersConstantinRubycodeandhowtotranslatetoregularmathwithoutalgebraforDSPcodeExampleTT1000mSecalpha1MathE1FsTalphaMathE1FsToutputalphaendT234361nFS48000nA0999911
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: 1645
 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 64bit ("doubleprecision"), even in 32bit 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 roundoff the values differently. This can be a problem sometimes for very small numbers, because a small 64bit number might get rounded down to zero (or a denormal number) when truncated to 32bits  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 32bit 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 64bit ("doubleprecision"), even in 32bit 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 roundoff the values differently. This can be a problem sometimes for very small numbers, because a small 64bit number might get rounded down to zero (or a denormal number) when truncated to 32bits  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 32bit 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: 1645
 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 33 guests