logarithms in ruby - working?

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

logarithms in ruby - working?

Post by tester »

Something like this.

Does it requires something else?
Attachments
ruby-log.fsm
(324 Bytes) Downloaded 881 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
CoreStylerz
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy
Contact:

Re: logarithms in ruby - working?

Post by CoreStylerz »

use Math.log(num,base)
Cattura.PNG
Cattura.PNG (9.1 KiB) Viewed 16416 times

http://www.ruby-doc.org/core-1.9.3/Math.html
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Post by tester »

Nope, not with array that way.
Attachments
ruby-log.fsm
(330 Bytes) Downloaded 864 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: logarithms in ruby - working?

Post by Nubeat7 »

you need to do it with each array element, using 'each' in a oneliner like this:

Code: Select all

output 0,@arr.each_index{|i|@arr[i]=Math.log(@arr[i],2)}
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Post by tester »

Okay, thanks on that.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: logarithms in ruby - working?

Post by RJHollins »

Good stuff NuBeat !!

Thanks for helping us all :)
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Post by tester »

There is one problem.
At each restart I get an error (see attached pic) and must retrig the module.
Attachments
Image1.png
Image1.png (8.94 KiB) Viewed 16389 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: logarithms in ruby - working?

Post by Nubeat7 »

hmm looks like it does the operation on loading, also when you click insideand change space or something it recalculates the array which contains the already processed values, like this the values are getting smaller till they are aout of range (minus)

just put it in an event methode, to only get triggered from input, i think this should solve the problem ( it does here )
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Post by tester »

I added afterload/dupkicate triggers for input, works too (no error display in schematic).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply