Rlab + Rlabplus
Total Page:16
File Type:pdf, Size:1020Kb
rlab + rlabplus c Marijan Koˇstrun [email protected] https://rlabplus.sourceforge.net March 23, 2020 2 rlabplus legal stuff This is rlabplus, a collection of numerical routines for scientific computing and other functions for rlab2 and rlab3 scripting languages. rlabplus is free software, you can redistribute it and/or modify it under the terms of the GNU General Public License. The GNU General Public License does not permit this software to be redistributed in proprietary programs. However, releasing closed-source add-ons with explecit purpose of making money while making world a better place through solving complex scientific problems, is encouraged. This collection is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Citation Info If you find rlab2 or rlab3 useful, please cite them in your research work as following: Marijan Koˇstrun, rlabplus (rlab2.2 through 2.5; rlab3), http://rlabplus.sourceforge.net, 2004-2020. Ian Searle and coworkers, rlab (through rlab2.1), http://rlab.sourceforge.net, 1992-2001. 3 In Memoriam Kodi and Otto in the Summer of 2004. 4 Contents I What is rlab? 19 1 Introduction 21 1.1 About . 21 1.2 About this Document . 21 1.3 What is new in rlab3 compared to rlab2? ............................ 22 1.4 Examples of New Constructs . 24 1.4.1 if-else ............................................ 24 1.4.2 for-then, while-then ................................... 25 1.4.3 do-while/until ....................................... 26 1.4.4 switch ............................................ 27 1.4.5 Modifiers +=, -=, *= and /= .............................. 28 1.4.6 function-static variables ................................ 29 1.4.7 EOF .............................................. 30 1.4.8 script ............................................ 31 1.4.9 classdef ........................................... 32 1.4.10 Future Developments . 33 1.5 On the shoulders of . 33 1.6 Commercial development . 34 2 Getting rlabplus to Run on a Linux System 35 2.1 Obtaining the Latest Source Code . 35 2.2 Building rlabplus ........................................... 35 2.3 gfortran vs. f77/g77, 32 vs. 64 bit . 37 2.4 Examples and Tests . 37 2.5 Default user paths . 37 3 Getting rlab to work for you 39 3.1 Basic types of variables . 39 3.2 Matrix Optimization . 42 II Solvers 43 4 Controlling rlab from command line 45 4.1 Command Line Input . 45 4.2 Accessing Command Line Options Inside rlab .......................... 46 4.2.1 argv . 46 5 6 CONTENTS 4.2.2 basename . 46 4.2.3 isinteractive . 46 5 Miscelaneous 47 5.1 Input/output/control functions . 47 5.1.1 stat . 47 5.1.2 inputs . 47 5.1.3 prompt . 48 5.1.4 randchar . 48 5.1.5 spinner . 49 5.1.6 smiley . 49 5.1.7 getmatrix . 49 5.1.8 hostname . 49 5.1.9 email . 50 5.1.10 ls . 50 5.1.11 mkdir . 50 5.1.12 mv . 50 5.1.13 pwd . 50 5.1.14 touch . 50 5.1.15 grep . 51 5.1.16 rlab initstderr . 51 5.1.17 view . 51 5.1.18 edit . 52 5.1.19 isfile . 52 5.1.20 isdir . 52 5.1.21 islink . 52 5.1.22 isblkspec . 52 5.1.23 ischarspec . 53 5.2 General purpose functions . 54 5.2.1 names . 54 5.2.2 range . 54 5.2.3 last, lastr, lastc . 54 5.3 File locking functions . 55 5.3.1 getpid . 55 5.3.2 lock . 55 5.3.3 unlock . 55 5.4 Timer Related Functions . 56 5.4.1 sleep . 56 5.4.2 tic . 56 5.4.3 toc . 56 5.5 Functions for Manipulating Dates . 57 5.5.1 seconds . 57 5.5.2 clock . 57 5.5.3 etime . 57 5.5.4 gmtime . 58 5.5.5 time2dstr . 58 5.5.6 dstr2time . 58 5.5.7 timezone . 59 CONTENTS 7 5.5.8 datesinrange . 59 5.5.9 dayofweek, dayofmonth, dayofyear . 59 5.5.10 isleapyear . 60 5.5.11 monthofyear, weekofyear . 60 5.5.12 daysinmonth, daysinyear, weeksinyear . 60 5.5.13 date2jd, date2mjd,jd2mjd . 60 5.5.14 yearnum . 61 5.5.15 otherday . 61 5.5.16 earliertime, latertime . 61 5.5.17 days2hms, hms2days . 61 5.5.18 hms2sec, sec2hms . 62 5.5.19 jd2date,jd2jdate, jdate2jd, jd2mjd, mjd2jd . 62 5.5.20 isdate, isjdate . ..