stick 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/COPYING +344 -0
- data/README +110 -0
- data/lib/stick/constants.rb +3 -0
- data/lib/stick/constants/cgs.rb +151 -0
- data/lib/stick/constants/mks.rb +158 -0
- data/lib/stick/constants/number.rb +33 -0
- data/lib/stick/constants/typeless_cgs.rb +141 -0
- data/lib/stick/constants/typeless_mks.rb +142 -0
- data/lib/stick/currency.rb +8 -0
- data/lib/stick/mapcar.rb +61 -0
- data/lib/stick/matrix.rb +1022 -0
- data/lib/stick/quaternion.rb +562 -0
- data/lib/stick/times.rb +441 -0
- data/lib/stick/units.rb +112 -0
- data/lib/stick/units/base.rb +980 -0
- data/lib/stick/units/currency.rb +159 -0
- data/lib/stick/units/data/binary/base.rb +4 -0
- data/lib/stick/units/data/cex.rb +5 -0
- data/lib/stick/units/data/currency-default.rb +5 -0
- data/lib/stick/units/data/currency-standard.rb +2 -0
- data/lib/stick/units/data/currency/base.rb +89 -0
- data/lib/stick/units/data/iec.rb +5 -0
- data/lib/stick/units/data/iec_binary/base.rb +6 -0
- data/lib/stick/units/data/si.rb +7 -0
- data/lib/stick/units/data/si/base.rb +9 -0
- data/lib/stick/units/data/si/derived.rb +26 -0
- data/lib/stick/units/data/si/extra.rb +22 -0
- data/lib/stick/units/data/uk.rb +10 -0
- data/lib/stick/units/data/uk/base.rb +22 -0
- data/lib/stick/units/data/units-default.rb +11 -0
- data/lib/stick/units/data/units-standard.rb +5 -0
- data/lib/stick/units/data/us.rb +10 -0
- data/lib/stick/units/data/us/base.rb +23 -0
- data/lib/stick/units/data/xmethods.rb +5 -0
- data/lib/stick/units/data/xmethods/cached.rb +84 -0
- data/lib/stick/units/data/xmethods/mapping.rb +87 -0
- data/lib/stick/units/loaders.rb +98 -0
- data/lib/stick/units/units.rb +109 -0
- data/meta/MANIFEST +76 -0
- data/meta/ROLLRC +2 -0
- data/meta/icli.yaml +16 -0
- data/meta/project.yaml +18 -0
- data/task/clobber/package +10 -0
- data/task/publish +57 -0
- data/task/release +10 -0
- data/task/setup +1616 -0
- data/task/test +25 -0
- data/test/spec_matrix.rb +342 -0
- data/test/test_currency.rb +26 -0
- data/test/test_matrix.rb +359 -0
- data/test/test_units.rb +205 -0
- data/work/TODO +20 -0
- data/work/bytes.rb +231 -0
- data/work/multipliers.rb +195 -0
- metadata +138 -0
data/CHANGES
ADDED
data/COPYING
ADDED
@@ -0,0 +1,344 @@
|
|
1
|
+
|
2
|
+
THE RUBY LICENSE
|
3
|
+
(http://www.ruby-lang.org/en/LICENSE.txt)
|
4
|
+
|
5
|
+
You may redistribute this software and/or modify it under either the terms of
|
6
|
+
the GPL (see below), or the conditions below:
|
7
|
+
|
8
|
+
1. You may make and give away verbatim copies of the source form of the
|
9
|
+
software without restriction, provided that you duplicate all of the
|
10
|
+
original copyright notices and associated disclaimers.
|
11
|
+
|
12
|
+
2. You may modify your copy of the software in any way, provided that
|
13
|
+
you do at least ONE of the following:
|
14
|
+
|
15
|
+
a) place your modifications in the Public Domain or otherwise
|
16
|
+
make them Freely Available, such as by posting said
|
17
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
18
|
+
the author to include your modifications in the software.
|
19
|
+
|
20
|
+
b) use the modified software only within your corporation or
|
21
|
+
organization.
|
22
|
+
|
23
|
+
c) rename any non-standard executables so the names do not conflict
|
24
|
+
with standard executables, which must also be provided.
|
25
|
+
|
26
|
+
d) make other distribution arrangements with the author.
|
27
|
+
|
28
|
+
3. You may distribute the software in object code or executable
|
29
|
+
form, provided that you do at least ONE of the following:
|
30
|
+
|
31
|
+
a) distribute the executables and library files of the software,
|
32
|
+
together with instructions (in the manual page or equivalent)
|
33
|
+
on where to get the original distribution.
|
34
|
+
|
35
|
+
b) accompany the distribution with the machine-readable source of
|
36
|
+
the software.
|
37
|
+
|
38
|
+
c) give non-standard executables non-standard names, with
|
39
|
+
instructions on where to get the original software distribution.
|
40
|
+
|
41
|
+
d) make other distribution arrangements with the author.
|
42
|
+
|
43
|
+
4. You may modify and include the part of the software into any other
|
44
|
+
software (possibly commercial). But some files in the distribution
|
45
|
+
are not written by the author, so that they are not under these terms.
|
46
|
+
|
47
|
+
For the list of those files and their copying conditions, see the
|
48
|
+
file LEGAL.
|
49
|
+
|
50
|
+
5. The scripts and library files supplied as input to or produced as
|
51
|
+
output from the software do not automatically fall under the
|
52
|
+
copyright of the software, but belong to whomever generated them,
|
53
|
+
and may be sold commercially, and may be aggregated with this
|
54
|
+
software.
|
55
|
+
|
56
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
57
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
58
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
59
|
+
PURPOSE.
|
60
|
+
|
61
|
+
----------------------------------------------------------------------------
|
62
|
+
|
63
|
+
|
64
|
+
GNU GENERAL PUBLIC LICENSE
|
65
|
+
Version 2, June 1991
|
66
|
+
|
67
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
68
|
+
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
69
|
+
Everyone is permitted to copy and distribute verbatim copies
|
70
|
+
of this license document, but changing it is not allowed.
|
71
|
+
|
72
|
+
Preamble
|
73
|
+
|
74
|
+
The licenses for most software are designed to take away your
|
75
|
+
freedom to share and change it. By contrast, the GNU General Public
|
76
|
+
License is intended to guarantee your freedom to share and change free
|
77
|
+
software--to make sure the software is free for all its users. This
|
78
|
+
General Public License applies to most of the Free Software
|
79
|
+
Foundation's software and to any other program whose authors commit to
|
80
|
+
using it. (Some other Free Software Foundation software is covered by
|
81
|
+
the GNU Library General Public License instead.) You can apply it to
|
82
|
+
your programs, too.
|
83
|
+
|
84
|
+
When we speak of free software, we are referring to freedom, not
|
85
|
+
price. Our General Public Licenses are designed to make sure that you
|
86
|
+
have the freedom to distribute copies of free software (and charge for
|
87
|
+
this service if you wish), that you receive source code or can get it
|
88
|
+
if you want it, that you can change the software or use pieces of it
|
89
|
+
in new free programs; and that you know you can do these things.
|
90
|
+
|
91
|
+
To protect your rights, we need to make restrictions that forbid
|
92
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
93
|
+
These restrictions translate to certain responsibilities for you if you
|
94
|
+
distribute copies of the software, or if you modify it.
|
95
|
+
|
96
|
+
For example, if you distribute copies of such a program, whether
|
97
|
+
gratis or for a fee, you must give the recipients all the rights that
|
98
|
+
you have. You must make sure that they, too, receive or can get the
|
99
|
+
source code. And you must show them these terms so they know their
|
100
|
+
rights.
|
101
|
+
|
102
|
+
We protect your rights with two steps: (1) copyright the software, and
|
103
|
+
(2) offer you this license which gives you legal permission to copy,
|
104
|
+
distribute and/or modify the software.
|
105
|
+
|
106
|
+
Also, for each author's protection and ours, we want to make certain
|
107
|
+
that everyone understands that there is no warranty for this free
|
108
|
+
software. If the software is modified by someone else and passed on, we
|
109
|
+
want its recipients to know that what they have is not the original, so
|
110
|
+
that any problems introduced by others will not reflect on the original
|
111
|
+
authors' reputations.
|
112
|
+
|
113
|
+
Finally, any free program is threatened constantly by software
|
114
|
+
patents. We wish to avoid the danger that redistributors of a free
|
115
|
+
program will individually obtain patent licenses, in effect making the
|
116
|
+
program proprietary. To prevent this, we have made it clear that any
|
117
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
118
|
+
|
119
|
+
The precise terms and conditions for copying, distribution and
|
120
|
+
modification follow.
|
121
|
+
|
122
|
+
GNU GENERAL PUBLIC LICENSE
|
123
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
124
|
+
|
125
|
+
0. This License applies to any program or other work which contains
|
126
|
+
a notice placed by the copyright holder saying it may be distributed
|
127
|
+
under the terms of this General Public License. The "Program", below,
|
128
|
+
refers to any such program or work, and a "work based on the Program"
|
129
|
+
means either the Program or any derivative work under copyright law:
|
130
|
+
that is to say, a work containing the Program or a portion of it,
|
131
|
+
either verbatim or with modifications and/or translated into another
|
132
|
+
language. (Hereinafter, translation is included without limitation in
|
133
|
+
the term "modification".) Each licensee is addressed as "you".
|
134
|
+
|
135
|
+
Activities other than copying, distribution and modification are not
|
136
|
+
covered by this License; they are outside its scope. The act of
|
137
|
+
running the Program is not restricted, and the output from the Program
|
138
|
+
is covered only if its contents constitute a work based on the
|
139
|
+
Program (independent of having been made by running the Program).
|
140
|
+
Whether that is true depends on what the Program does.
|
141
|
+
|
142
|
+
1. You may copy and distribute verbatim copies of the Program's
|
143
|
+
source code as you receive it, in any medium, provided that you
|
144
|
+
conspicuously and appropriately publish on each copy an appropriate
|
145
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
146
|
+
notices that refer to this License and to the absence of any warranty;
|
147
|
+
and give any other recipients of the Program a copy of this License
|
148
|
+
along with the Program.
|
149
|
+
|
150
|
+
You may charge a fee for the physical act of transferring a copy, and
|
151
|
+
you may at your option offer warranty protection in exchange for a fee.
|
152
|
+
|
153
|
+
2. You may modify your copy or copies of the Program or any portion
|
154
|
+
of it, thus forming a work based on the Program, and copy and
|
155
|
+
distribute such modifications or work under the terms of Section 1
|
156
|
+
above, provided that you also meet all of these conditions:
|
157
|
+
|
158
|
+
a) You must cause the modified files to carry prominent notices
|
159
|
+
stating that you changed the files and the date of any change.
|
160
|
+
|
161
|
+
b) You must cause any work that you distribute or publish, that in
|
162
|
+
whole or in part contains or is derived from the Program or any
|
163
|
+
part thereof, to be licensed as a whole at no charge to all third
|
164
|
+
parties under the terms of this License.
|
165
|
+
|
166
|
+
c) If the modified program normally reads commands interactively
|
167
|
+
when run, you must cause it, when started running for such
|
168
|
+
interactive use in the most ordinary way, to print or display an
|
169
|
+
announcement including an appropriate copyright notice and a
|
170
|
+
notice that there is no warranty (or else, saying that you provide
|
171
|
+
a warranty) and that users may redistribute the program under
|
172
|
+
these conditions, and telling the user how to view a copy of this
|
173
|
+
License. (Exception: if the Program itself is interactive but
|
174
|
+
does not normally print such an announcement, your work based on
|
175
|
+
the Program is not required to print an announcement.)
|
176
|
+
|
177
|
+
These requirements apply to the modified work as a whole. If
|
178
|
+
identifiable sections of that work are not derived from the Program,
|
179
|
+
and can be reasonably considered independent and separate works in
|
180
|
+
themselves, then this License, and its terms, do not apply to those
|
181
|
+
sections when you distribute them as separate works. But when you
|
182
|
+
distribute the same sections as part of a whole which is a work based
|
183
|
+
on the Program, the distribution of the whole must be on the terms of
|
184
|
+
this License, whose permissions for other licensees extend to the
|
185
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
186
|
+
|
187
|
+
Thus, it is not the intent of this section to claim rights or contest
|
188
|
+
your rights to work written entirely by you; rather, the intent is to
|
189
|
+
exercise the right to control the distribution of derivative or
|
190
|
+
collective works based on the Program.
|
191
|
+
|
192
|
+
In addition, mere aggregation of another work not based on the Program
|
193
|
+
with the Program (or with a work based on the Program) on a volume of
|
194
|
+
a storage or distribution medium does not bring the other work under
|
195
|
+
the scope of this License.
|
196
|
+
|
197
|
+
3. You may copy and distribute the Program (or a work based on it,
|
198
|
+
under Section 2) in object code or executable form under the terms of
|
199
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
200
|
+
|
201
|
+
a) Accompany it with the complete corresponding machine-readable
|
202
|
+
source code, which must be distributed under the terms of Sections
|
203
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
204
|
+
|
205
|
+
b) Accompany it with a written offer, valid for at least three
|
206
|
+
years, to give any third party, for a charge no more than your
|
207
|
+
cost of physically performing source distribution, a complete
|
208
|
+
machine-readable copy of the corresponding source code, to be
|
209
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
210
|
+
customarily used for software interchange; or,
|
211
|
+
|
212
|
+
c) Accompany it with the information you received as to the offer
|
213
|
+
to distribute corresponding source code. (This alternative is
|
214
|
+
allowed only for noncommercial distribution and only if you
|
215
|
+
received the program in object code or executable form with such
|
216
|
+
an offer, in accord with Subsection b above.)
|
217
|
+
|
218
|
+
The source code for a work means the preferred form of the work for
|
219
|
+
making modifications to it. For an executable work, complete source
|
220
|
+
code means all the source code for all modules it contains, plus any
|
221
|
+
associated interface definition files, plus the scripts used to
|
222
|
+
control compilation and installation of the executable. However, as a
|
223
|
+
special exception, the source code distributed need not include
|
224
|
+
anything that is normally distributed (in either source or binary
|
225
|
+
form) with the major components (compiler, kernel, and so on) of the
|
226
|
+
operating system on which the executable runs, unless that component
|
227
|
+
itself accompanies the executable.
|
228
|
+
|
229
|
+
If distribution of executable or object code is made by offering
|
230
|
+
access to copy from a designated place, then offering equivalent
|
231
|
+
access to copy the source code from the same place counts as
|
232
|
+
distribution of the source code, even though third parties are not
|
233
|
+
compelled to copy the source along with the object code.
|
234
|
+
|
235
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
236
|
+
except as expressly provided under this License. Any attempt
|
237
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
238
|
+
void, and will automatically terminate your rights under this License.
|
239
|
+
However, parties who have received copies, or rights, from you under
|
240
|
+
this License will not have their licenses terminated so long as such
|
241
|
+
parties remain in full compliance.
|
242
|
+
|
243
|
+
5. You are not required to accept this License, since you have not
|
244
|
+
signed it. However, nothing else grants you permission to modify or
|
245
|
+
distribute the Program or its derivative works. These actions are
|
246
|
+
prohibited by law if you do not accept this License. Therefore, by
|
247
|
+
modifying or distributing the Program (or any work based on the
|
248
|
+
Program), you indicate your acceptance of this License to do so, and
|
249
|
+
all its terms and conditions for copying, distributing or modifying
|
250
|
+
the Program or works based on it.
|
251
|
+
|
252
|
+
6. Each time you redistribute the Program (or any work based on the
|
253
|
+
Program), the recipient automatically receives a license from the
|
254
|
+
original licensor to copy, distribute or modify the Program subject to
|
255
|
+
these terms and conditions. You may not impose any further
|
256
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
257
|
+
You are not responsible for enforcing compliance by third parties to
|
258
|
+
this License.
|
259
|
+
|
260
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
261
|
+
infringement or for any other reason (not limited to patent issues),
|
262
|
+
conditions are imposed on you (whether by court order, agreement or
|
263
|
+
otherwise) that contradict the conditions of this License, they do not
|
264
|
+
excuse you from the conditions of this License. If you cannot
|
265
|
+
distribute so as to satisfy simultaneously your obligations under this
|
266
|
+
License and any other pertinent obligations, then as a consequence you
|
267
|
+
may not distribute the Program at all. For example, if a patent
|
268
|
+
license would not permit royalty-free redistribution of the Program by
|
269
|
+
all those who receive copies directly or indirectly through you, then
|
270
|
+
the only way you could satisfy both it and this License would be to
|
271
|
+
refrain entirely from distribution of the Program.
|
272
|
+
|
273
|
+
If any portion of this section is held invalid or unenforceable under
|
274
|
+
any particular circumstance, the balance of the section is intended to
|
275
|
+
apply and the section as a whole is intended to apply in other
|
276
|
+
circumstances.
|
277
|
+
|
278
|
+
It is not the purpose of this section to induce you to infringe any
|
279
|
+
patents or other property right claims or to contest validity of any
|
280
|
+
such claims; this section has the sole purpose of protecting the
|
281
|
+
integrity of the free software distribution system, which is
|
282
|
+
implemented by public license practices. Many people have made
|
283
|
+
generous contributions to the wide range of software distributed
|
284
|
+
through that system in reliance on consistent application of that
|
285
|
+
system; it is up to the author/donor to decide if he or she is willing
|
286
|
+
to distribute software through any other system and a licensee cannot
|
287
|
+
impose that choice.
|
288
|
+
|
289
|
+
This section is intended to make thoroughly clear what is believed to
|
290
|
+
be a consequence of the rest of this License.
|
291
|
+
|
292
|
+
8. If the distribution and/or use of the Program is restricted in
|
293
|
+
certain countries either by patents or by copyrighted interfaces, the
|
294
|
+
original copyright holder who places the Program under this License
|
295
|
+
may add an explicit geographical distribution limitation excluding
|
296
|
+
those countries, so that distribution is permitted only in or among
|
297
|
+
countries not thus excluded. In such case, this License incorporates
|
298
|
+
the limitation as if written in the body of this License.
|
299
|
+
|
300
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
301
|
+
of the General Public License from time to time. Such new versions will
|
302
|
+
be similar in spirit to the present version, but may differ in detail to
|
303
|
+
address new problems or concerns.
|
304
|
+
|
305
|
+
Each version is given a distinguishing version number. If the Program
|
306
|
+
specifies a version number of this License which applies to it and "any
|
307
|
+
later version", you have the option of following the terms and conditions
|
308
|
+
either of that version or of any later version published by the Free
|
309
|
+
Software Foundation. If the Program does not specify a version number of
|
310
|
+
this License, you may choose any version ever published by the Free Software
|
311
|
+
Foundation.
|
312
|
+
|
313
|
+
10. If you wish to incorporate parts of the Program into other free
|
314
|
+
programs whose distribution conditions are different, write to the author
|
315
|
+
to ask for permission. For software which is copyrighted by the Free
|
316
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
317
|
+
make exceptions for this. Our decision will be guided by the two goals
|
318
|
+
of preserving the free status of all derivatives of our free software and
|
319
|
+
of promoting the sharing and reuse of software generally.
|
320
|
+
|
321
|
+
NO WARRANTY
|
322
|
+
|
323
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
324
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
325
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
326
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
327
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
328
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
329
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
330
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
331
|
+
REPAIR OR CORRECTION.
|
332
|
+
|
333
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
334
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
335
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
336
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
337
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
338
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
339
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
340
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
341
|
+
POSSIBILITY OF SUCH DAMAGES.
|
342
|
+
|
343
|
+
END OF TERMS AND CONDITIONS
|
344
|
+
|
data/README
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
= STICK
|
2
|
+
|
3
|
+
STICK stands for Scientific Code Kit. It's main feature is the
|
4
|
+
a sophisticated SI units system.
|
5
|
+
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
You can install via Rubygems
|
10
|
+
|
11
|
+
gems install stick
|
12
|
+
|
13
|
+
or via tarball
|
14
|
+
|
15
|
+
tar -xzf stick-x.y.z.tar.gz
|
16
|
+
cd stick
|
17
|
+
sudo util/setup
|
18
|
+
|
19
|
+
(on Windows 'ruby util/setup')
|
20
|
+
|
21
|
+
|
22
|
+
== Usage
|
23
|
+
|
24
|
+
=== Units System
|
25
|
+
|
26
|
+
Here are some examples of using the units system.
|
27
|
+
|
28
|
+
reqiure 'stick/units'
|
29
|
+
|
30
|
+
1.bit/s + 8.bytes/s
|
31
|
+
(1.bit/s).to(byte/s)
|
32
|
+
1.mile.to(feet)
|
33
|
+
1.acre.to(yd**2)
|
34
|
+
1.acre.to(sq_yd)
|
35
|
+
1.gallon.to(self.L)
|
36
|
+
1.lb.to(kg)
|
37
|
+
1.m.s.to(m.s)
|
38
|
+
1.sq_mi.to(km**2)
|
39
|
+
1.mile.to(km)
|
40
|
+
1.usd.to(twd)
|
41
|
+
|
42
|
+
The Units is namespace for all unit related classes. Mixing this in has
|
43
|
+
the additional effect of making Units.with_unit_converter available
|
44
|
+
without the <code>Units.</code> prefix, as well as the shortcuts for
|
45
|
+
creating Units (see Units#method_missing).
|
46
|
+
|
47
|
+
=== Constants
|
48
|
+
|
49
|
+
Also included are a large assortment of real world contants.
|
50
|
+
The constants are stored in the Math::Constants module, but this
|
51
|
+
is included in Math for direct use by other Math libraries.
|
52
|
+
Math::Constants::CGS provides the constants in cm kg s format,
|
53
|
+
instead of the standard m kg s. Some examples...
|
54
|
+
|
55
|
+
require 'stick/constants'
|
56
|
+
|
57
|
+
Math::SPEED_OF_LIGHT #=> 2.99792458e8
|
58
|
+
Math::CGS::SPEED_OF_LIGHT #=> 2.99792458e10
|
59
|
+
Math::Constants::SPEED_OF_LIGHT #=> 2.99792458e8
|
60
|
+
Math::Constants::CGS::SPEED_OF_LIGHT #=> 2.99792458e10
|
61
|
+
|
62
|
+
=== Date/Time convenience methods
|
63
|
+
|
64
|
+
There are also some convenience libraries for working with dates and times.
|
65
|
+
|
66
|
+
require 'stick/time'
|
67
|
+
|
68
|
+
10.minutes.since(Time.now)
|
69
|
+
2.years.from_now
|
70
|
+
7.weekdays.ago
|
71
|
+
Time.now.next_year
|
72
|
+
|
73
|
+
|
74
|
+
=== Extensions to the Ruby's Matrix
|
75
|
+
|
76
|
+
This is work done by Cosmin Bonchis as a Google Summer of Code 2007 project for Ruby Central Inc.
|
77
|
+
|
78
|
+
The project consists of some enhancements to the Ruby "Matrix" module and includes: LU and QR (Householder, Givens, Gram Schmidt, Hessenberg) decompositions, bidiagonalization, eigenvalue and eigenvector calculations.
|
79
|
+
|
80
|
+
This archive contains in extendmatrix.rb file the source code of the project, an implementation of mapcar used in extending matrix, and all the tests files in the "tests" directory.
|
81
|
+
|
82
|
+
The code can also be found on the RubyForge repository at http://matrix.rubyforge.org/svn/trunk/ or the project's SVN repository can be checked out through anonymous access with the following command(s).
|
83
|
+
|
84
|
+
svn checkout svn://rubyforge.org/var/svn/matrix
|
85
|
+
svn checkout http://matrix.rubyforge.org/svn/trunk/
|
86
|
+
|
87
|
+
|
88
|
+
== Authors/Contributors
|
89
|
+
|
90
|
+
* Peter Vanbroekhoven (primary author)
|
91
|
+
* Thomas Sawyer
|
92
|
+
* Cosmin Bonchis
|
93
|
+
|
94
|
+
|
95
|
+
== Relevant URLs
|
96
|
+
|
97
|
+
Rubyforge project site:
|
98
|
+
|
99
|
+
http://rubyforge.org/projects/stick
|
100
|
+
|
101
|
+
Orginal Matrix extensions:
|
102
|
+
|
103
|
+
http://matrix.rubyforge.org/svn/trunk/
|
104
|
+
|
105
|
+
|
106
|
+
== License
|
107
|
+
|
108
|
+
Copyright 2006-2007 Peter Vanbroekhoven
|
109
|
+
|
110
|
+
Ruby/GPL Licensed
|