Support

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

logarithms in ruby - working?

For general discussion related FlowStone

logarithms in ruby - working?

Postby tester » Tue May 20, 2014 8:59 am

Something like this.

Does it requires something else?
Attachments
ruby-log.fsm
(324 Bytes) Downloaded 759 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Postby CoreStylerz » Tue May 20, 2014 12:25 pm

use Math.log(num,base)
Cattura.PNG
Cattura.PNG (9.1 KiB) Viewed 13726 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.
User avatar
CoreStylerz
 
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy

Re: logarithms in ruby - working?

Postby tester » Tue May 20, 2014 6:24 pm

Nope, not with array that way.
Attachments
ruby-log.fsm
(330 Bytes) Downloaded 750 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Postby Nubeat7 » Tue May 20, 2014 9:11 pm

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)}
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: logarithms in ruby - working?

Postby tester » Tue May 20, 2014 10:53 pm

Okay, thanks on that.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Postby RJHollins » Tue May 20, 2014 11:16 pm

Good stuff NuBeat !!

Thanks for helping us all :)
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: logarithms in ruby - working?

Postby tester » Tue May 20, 2014 11:53 pm

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 13699 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: logarithms in ruby - working?

Postby Nubeat7 » Wed May 21, 2014 12:18 am

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 )
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: logarithms in ruby - working?

Postby tester » Wed May 21, 2014 12:38 am

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.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet


Return to General

Who is online

Users browsing this forum: No registered users and 79 guests