{"id":3339,"date":"2012-07-16T23:14:11","date_gmt":"2012-07-17T03:14:11","guid":{"rendered":"http:\/\/mathgradblog.williams.edu\/?p=3339"},"modified":"2012-07-16T23:14:11","modified_gmt":"2012-07-17T03:14:11","slug":"save-time-software-libraries","status":"publish","type":"post","link":"https:\/\/blogs.ams.org\/mathgradblog\/2012\/07\/16\/save-time-software-libraries\/","title":{"rendered":"Save Time With Software Libraries"},"content":{"rendered":"<p>Do you know a programming language? Do you think you will have to learn one for your research? As a former software developer, I have a few opinons on the subject. First, in line with my general teaching philosophy, I believe it&#8217;s boring to learn to program for programming&#8217;s sake. Same with learning a new language. When learning a language, you really should have a specific problem you&#8217;re attempting to solve (creating a video game, solving a particular equation, making a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Logo_(programming_language)\">turtle move<\/a> across the screen). Second, after you learn a language or two, becoming proficient in a new language is a matter of learning the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Programming_idiom\">specific idioms<\/a> which allow you to accomplish the tasks you have in mind, as well as studying built-in and popular libraries for the new programming environment. This brings me to my main point, don&#8217;t <a href=\"http:\/\/c2.com\/cgi\/wiki?ReinventingTheWheel\">reinvent the wheel<\/a>. Read on if you want to learn about some wheels which have already been invented, that is, libraries and environments for mathematical computation.<\/p>\n<p><!--more--><\/p>\n<p>Suppose you were at a point in your reseach which required results from a computer to continue. The computer program you need to write requires some basic data structure or mathematical object such as a tree or a matrix. It can be satisfying, almost addictive, to write all of the necessary tools from scratch. Be mindful of why exactly you&#8217;re writing each piece of code: for fun, to learn the details of a known algorithm or to directly further your research. A straightforward programming task can be fun like a mathematical puzzle, and writing these small programs may be a valuable source of stress relief. Similar to mathematics, if you haven&#8217;t seen an argument or trick before you should attempt to prove it for yourself. The programming analog would be building your own toy implmentation of a library function, as you sometimes won&#8217;t fully understand and appreciate the existence of a particular software tool until you&#8217;ve attempted writing it yourself. But if programming for fun or to learn distracts from progress, it might be time to pull the plug and use a library.<\/p>\n<p>Why should you prefer libraries to hand-written code? Allow me to make one argument based on language. The mathematical language you would use to write a proof, like other natural languages, contain conventions which provide an informal way to handle various unimportant alternatives. Error handling in software is a giant pain. A second justification is efficiency; there&#8217;s a good chance your code will run an order of magnitude slower than a popular available library. Using pre-existing libraries may save time, especially when they provide a service you use frequently. Finally, after familiarizing yourself with an <a href=\"http:\/\/www.ams.org\/notices\/200710\/tx071001279p.pdf\">opensource tool<\/a> you may stumble upon the opportunity to contribute back to the project with bug fixes or new features.<\/p>\n<p>Since I love a good list, I&#8217;m going end this post with links to opensource mathematical software you may find handy. Feel free to add your picks, or corrections, in the comments!<\/p>\n<p><a href=\"http:\/\/\"><\/a><\/p>\n<ul>\n<li><a href=\"http:\/\/www.sagemath.org\/\">Sage<\/a> &#8211; a computing environment pieced together from <a href=\"http:\/\/www.sagemath.org\/links-components.html\">numerous open source packages<\/a> and glued via Python, plotting facilities, licensed under GPL. Every mathematics student should be aware of Sage.<\/li>\n<li><a href=\"http:\/\/www.gnu.org\/software\/octave\/\">Octave<\/a> &#8211; numerical computation environment, similar to Matlab (in fact the languages are compatible to an extent), plotting facilities, GPL license.<\/li>\n<li><a href=\"http:\/\/www.r-project.org\/\">The R Project<\/a> &#8211; statistical computing environment, plotting facilities, available in SAGE, licensed under GPL.<\/li>\n<li>GAP &#8211; computer algebra tool with focus on group theory, included in SAGE, licensed under GPL.<\/li>\n<li><a href=\"http:\/\/pari.math.u-bordeaux.fr\/\">PARI\/GP<\/a> &#8211; another computer algebra tool, included in SAGE, licensed under GPL.<\/li>\n<li><a href=\"http:\/\/maxima.sourceforge.net\/\">Maxima<\/a> &#8211; one more computer algebra system, included in SAGE and licensed under the GPL. (Sorry, I don&#8217;t know much about computer algebra systems!)<\/li>\n<li>Numpy &#8211; widely-used implementation of multi-dimensional array data types and linear algebra functions, uses <a href=\"http:\/\/www.netlib.org\/fftpack\/\">FFTPACK<\/a>, available through SAGE or directly in Python language, Numpy license.<\/li>\n<li><a href=\"http:\/\/www.scipy.org\/\">SciPy<\/a> &#8211; numerical computing environment using the Python language and Numpy library, plotting facilities, also available in SAGE, BSD license.<\/li>\n<li><a href=\"http:\/\/commons.apache.org\/math\/\">Apache Commons Math<\/a> &#8211; useful mathematical tools for the Java language in the areas of statistics, linear algebra, numerical analysis, Apache license.<\/li>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_44_0\/libs\/math\/doc\/sf_and_dist\/html\/index.html\">Boost Math Toolkit<\/a> &#8211; collection of statistical distributions and special functions implemented in C++, Boost license. For the C++ nerds in the audience, note that many features are inducted into the standard library after implementations are stable in Boost for years.<\/li>\n<li><a href=\"http:\/\/www.boost.org\/doc\/libs\/1_50_0\/libs\/graph\/doc\/index.html\">Boost Graph Library<\/a> &#8211; high quality graph data structures and algorithms, like most of Boost makes heavy use of templated\/generic C++, Boost license.<\/li>\n<li><a href=\"http:\/\/www.gnu.org\/software\/gsl\/\">GSL<\/a> &#8211; collection of scientific routines for C and C++, licensed under GPL. Go here or <a href=\"http:\/\/www.netlib.org\/\">Netlib<\/a> before you implement something from <a href=\"http:\/\/www.nr.com\/oldverswitcher.html\">Numerical Recipes<\/a>.<\/li>\n<li><a href=\"http:\/\/www.netlib.org\/\">Netlib<\/a> &#8211; collection of numerical algorithms maintained by &#8220;AT&amp;T Bell Laboratories, the University of Tennessee and Oak Ridge National Laboratory, and by colleagues world-wide,&#8221; libraries are mostly written in Fortran with some in C, various licenses.<\/li>\n<li><a href=\"http:\/\/www.netlib.org\/lapack\/\">LAPACK<\/a> &#8211; famous linear algebra library written in Fortran and highly tuned, available through SAGE and other environments, BSD license.<\/li>\n<li><a href=\"http:\/\/www.fftw.org\/\">FFTW<\/a> &#8211; like the name says it&#8217;s the Fastest Fourier Transform in the West, written in C, available through Octave, licensed under GPL.<\/li>\n<li><a href=\"http:\/\/trilinos.sandia.gov\/\">The Trilinos Project<\/a> &#8211; collection of C++ libraries for linear algebra, nonlinear optimization, mesh generation, maintained by Sandia National Laboratories, BSD license.<\/li>\n<li><a href=\"http:\/\/dakota.sandia.gov\/\">The DAKOTA Project<\/a> &#8211; another C++ collection from Sandia National Laboratories for optimization and uncertainty analysis, BSD license.<\/li>\n<li><a href=\"http:\/\/www.feynarts.de\/cuba\/\">Cuba Library<\/a> &#8211; multidimensional numerical integration with interfaces in C, C++ and Fortran, licensed under the LGPL.<\/li>\n<\/ul>\n<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div>","protected":false},"excerpt":{"rendered":"<p>Do you know a programming language? Do you think you will have to learn one for your research? As a former software developer, I have a few opinons on the subject. First, in line with my general teaching philosophy, I &hellip; <a href=\"https:\/\/blogs.ams.org\/mathgradblog\/2012\/07\/16\/save-time-software-libraries\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" data-url=https:\/\/blogs.ams.org\/mathgradblog\/2012\/07\/16\/save-time-software-libraries\/><\/div>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,8,21],"tags":[],"class_list":["post-3339","post","type-post","status-publish","format-standard","hentry","category-advice","category-general","category-technology-math"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3gbww-RR","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts\/3339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/comments?post=3339"}],"version-history":[{"count":0,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts\/3339\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/media?parent=3339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/categories?post=3339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/tags?post=3339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}