Complex numbers and other libraries
-
Can anyone tell me how to use other ruby libraries like the complex number functions in the Ruby in Sketchup? Khalid at http://www.betterexplained.com has rocked my world and has got me scrambling to apply euler's formula to simple animation as a teaching tool. All of you wizards out there can take this as a general question about other libraries as well. Thanks heaps.
-
Thanks for that link!
(Sorry I'm not sure about your question though. Is it a module part of the standard Ruby?)
-
I think so. Complex(10,2) should yield 10 + 2i. In ruby 1.9.2 it is a Class with a parent being numeric. If it sounds like I don't know what I'm talking about its cause I don't know what I'm talking about....However Complex numbers are a part of the TI83 Calculator Basic but not a standard function in Google Docs Spreadsheets.
Thanks for your great work..
-
It's a class under Ruby 1.9. But I don't see it for 1.8.6 (which is what SU uses). http://www.ruby-doc.org/core-1.8.6/index.html
-
It's in the Standard (ie Extended,) Libraries for 1.8.6 (not in the Core.)
In Files
lib/complex.rb
lib/mathn.rbYou need a full ruby installation.
You need to add paths to the $LOAD_PATH array.
I have a topic on this and a utility script called !loadpaths.rb
Addenda: -See these posts:
-
for the !loadpaths.rb script:
[code] Ruby LOAD PATHs script for (Win32) -
and for info: same topic near the bottom..
-
for the complete Ruby libraries (with precompiled .so files,) direct from ftp.ruby-lang.org:
-
to match SU 8.0M0 & M1: ruby 1.8.6-p287* for Ruby 1.8.6-p369 (latest as of this posting.)
-
requires you replace DLL in Sketchup program folder if on Windows.* See instructions: Ruby Interpreter DLLs (Win32)
Also see: Ruby Newbie's Guide to Getting Started
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement