<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/math">
  <channel>
    <title>Math</title>
    <link>https://www.linuxjournal.com/tag/math</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Getting Started with Scilab</title>
  <link>https://www.linuxjournal.com/content/getting-started-scilab</link>
  <description>  &lt;div data-history-node-id="1340162" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/bigstock--158388092_0.jpg" width="800" height="572" alt="""" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;&lt;em&gt;Introducing one of the larger scientific lab packages for Linux.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://www.scilab.org"&gt;Scilab&lt;/a&gt;
is meant to be an overall package for numerical science, along the
lines of Maple, Matlab or Mathematica. Although a lot of built-in
functionality exists for all sorts of scientific computations, Scilab
also includes its own programming language, which allows you to use that functionality
to its utmost. If you prefer, you instead can use this language to extend
Scilab's functionality into completely new areas of research. Some of
the functionality includes 2D and 3D visualization and optimization tools,
as well as statistical functions. Also included in Scilab is Xcos, an
editor for
designing dynamical systems models.
&lt;/p&gt;

&lt;p&gt;
Several options exist for installing Scilab on your system. Most package
management systems should have one or more packages available for
Scilab, which also will install several support packages. Or, you
simply can download and install a tarball that contains
everything you need to be able to run Scilab on your system.
&lt;/p&gt;

&lt;p&gt;
Once
it's installed, start the GUI version of Scilab with
the &lt;code&gt;scilab&lt;/code&gt; command. If you installed Scilab via tarball, this command will
be located in the bin subdirectory where you unpacked the tarball.
&lt;/p&gt;

&lt;p&gt;
When
it first starts, you should see a full workspace created for your
project.
&lt;/p&gt;

&lt;img src="https://www.linuxjournal.com/sites/default/files/styles/max_650x650/public/u%5Buid%5D/12563f1.png" width="650" height="386" alt="""" class="image-max_650x650" /&gt;&lt;p&gt;
&lt;em&gt;Figure 1. When you first start Scilab, you'll see an empty
workspace ready for you to start a new project.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
On the left-hand side is a file browser where you can see data
files and Scilab scripts. The right-hand side has several
panes. The top pane is a variable browser, where you can see what
currently exists within the workspace. The middle pane contains a
list of commands within that workspace, and the bottom pane has
a news feed of Scilab-related news. The center of the workspace is the
actual Scilab console where you can interact with the execution engine.
&lt;/p&gt;

&lt;p&gt;
Let's start with some basic mathematics—for example,
division:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
--&gt; 23/7
 ans  =

   3.2857143
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
As you can see, the command prompt is &lt;code&gt;--&gt;&lt;/code&gt;, where you enter the
next command to the execution engine. In the variable browser, you
can see a new variable named &lt;code&gt;ans&lt;/code&gt; that contains the results of the
calculation.
&lt;/p&gt;

&lt;p&gt;
Along with basic arithmetic, there is also a number of built-in functions. One thing to be aware of is that these function names are
case-sensitive. For example, the statement &lt;code&gt;sqrt(9)&lt;/code&gt; gives the answer
of 3, whereas the statement &lt;code&gt;SQRT(9)&lt;/code&gt; returns an error.
&lt;/p&gt;

&lt;p&gt;
There
also are built-in constants for numbers like e or pi. You can use them
in statements, like this command to find the sine of pi/2:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/getting-started-scilab" hreflang="en"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Thu, 15 Nov 2018 13:15:15 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1340162 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Introducing Genius, the Advanced Scientific Calculator for Linux</title>
  <link>https://www.linuxjournal.com/content/introducing-genius-advanced-scientific-calculator-linux</link>
  <description>  &lt;div data-history-node-id="1340144" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/bigstock--155415164.jpg" width="800" height="533" alt="Math" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Genius is a calculator
program that has both a command-line version and a GNOME GUI version.
It should available in your distribution's package management
system.
For Debian-based distributions, the GUI version and the
command-line version are two separate packages. Assuming that you want
to install both, you can do so with the following command:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
sudo apt-get install genius gnome-genius
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
If you use Ubuntu, be aware that the package
gnome-genius doesn't appear to be in Bionic. It's in earlier versions
(trusty, xenial and arty), and it appears to be in the next version (cosmic). I
ran into this problem, and thought I'd mention it to
save you some aggravation.
&lt;/p&gt;

&lt;p&gt;
Starting the command-line version provides an
interpreter that should be familiar to Python or R users.
&lt;/p&gt;

&lt;img src="https://www.linuxjournal.com/sites/default/files/styles/max_650x650/public/u%5Buid%5D/12552f1.png" width="650" height="445" alt="""" class="image-max_650x650" /&gt;&lt;p&gt;
&lt;em&gt;Figure 1. When you start Genius, you get the version and some license
information, and then you'll see the interpreter prompt.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
If you start gnome-genius, you'll see a graphical interface that is likely
to be more comfortable to new users. For the rest of this
article, I'm using the GUI version in order to demonstrate some
of the things you can do with Genius.
&lt;/p&gt;

&lt;img src="https://www.linuxjournal.com/sites/default/files/styles/max_650x650/public/u%5Buid%5D/12552f2.png" width="650" height="493" alt="""" class="image-max_650x650" /&gt;&lt;p&gt;
&lt;em&gt;Figure 2. The GUI interface provides easy menu access to most of the
functionality within Genius.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
You can use Genius just as a general-purpose calculator, so you can do
things like:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
genius&gt; 4+5
= 9
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
Along with basic math operators, you also can use trigonometric
functions. This command gives the sine of 45 degrees:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
genius&gt; sin(45)
= 0.850903524534
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
These types of calculations can be of essentially arbitrary size. You
also can use complex numbers out of the box. Many other standard
mathematical functions are available as well, including
items like logarithms, statistics, combinatorics and even calculus
functions.
&lt;/p&gt;

&lt;p&gt;
Along with functions, Genius also provides control structures like
conditionals and looping structures. For example, the following code gives
you a basic &lt;code&gt;for&lt;/code&gt; loop that prints out the sine of the first 90
degrees:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
for i = 1 to 90 do (
   x = sin(i);
   print(x)
)
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
As you can see, the syntax is almost C-like. At first blush, it looks like
the semicolon is being used as a line-ending character, but it's actually
a command separator. That's why there is a semicolon on the line with
the sine function, but there is no semicolon on the line with the print
function. This means you could write the &lt;code&gt;for&lt;/code&gt; loop as the
following:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/introducing-genius-advanced-scientific-calculator-linux" hreflang="en"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Fri, 05 Oct 2018 11:30:00 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1340144 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>A Look at KDE's KAlgebra</title>
  <link>https://www.linuxjournal.com/content/look-kdes-kalgebra</link>
  <description>  &lt;div data-history-node-id="1340089" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Kalgebra.svg_.png" width="600" height="600" alt="KAlgebra logo" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Many of the programs I've covered in the past have have been
desktop-environment-agnostic—all they required was some sort of
graphical display running. This article looks at one of the programs
available in the KDE desktop environment, KAlgebra.
&lt;/p&gt;

&lt;p&gt;
You can use your distribution's
package management system to install it, or you can use Discover,
KDE's package manager. After it's installed, you can start it
from the command line or the launch menu.
&lt;/p&gt;

&lt;p&gt;
When you first start KAlgebra, you get a blank slate to start doing
calculations.
&lt;/p&gt;

&lt;img src="https://www.linuxjournal.com/sites/default/files/styles/max_650x650/public/u%5Buid%5D/12536f1.png" width="650" height="388" alt="""" class="image-max_650x650" /&gt;&lt;p&gt;&lt;em&gt;Figure 1. When you start KAlgebra, you get a blank canvas for doing
calculations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;
The screen layout is a large main pane
where all of the calculations and their results are displayed. At the
top of this pane are four tabs: Calculator, 2D
Graph, 3D Graph and Dictionary.
There's also a
smaller pane on the right-hand side used for different purposes
for each tab.
&lt;/p&gt;

&lt;p&gt;
In the calculator tab, the side pane gives a list of
variables, including predefined variables for things like pi
or euler, available when you start your new session. You can add new
variables with the following syntax:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
a := 3
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
This creates a new variable named &lt;code&gt;a&lt;/code&gt; with an initial value of
3. This new variable also will be visible in the list on the right-hand
side. Using these variables is as easy as executing them. For example,
you can double it with the following:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
a * 2
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
There is a special variable called &lt;code&gt;ans&lt;/code&gt; that you can use to get the
result from your most recent calculation. All of the standard mathematical
operators are available for doing calculations.
&lt;/p&gt;

&lt;img src="https://www.linuxjournal.com/sites/default/files/styles/max_650x650/public/u%5Buid%5D/12536f2.png" width="650" height="388" alt="""" class="image-max_650x650" /&gt;&lt;p&gt;&lt;em&gt;
Figure 2. KAlgebra lets you create your own variables and functions for
even more complex calculations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;
There's also a complete set of functions for doing more
complex calculations, such as trigonometric
functions, mathematical functions like absolute value or floor, and even
calculus functions like finding the derivative. For instance, the following
lets you find the sine of 45 degrees:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
sin(45)
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
You also can define your own functions using the
lambda operator &lt;code&gt;-&gt;&lt;/code&gt;. If you want to create a function that
calculates cubes, you could do this:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
x -&gt; x^3
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
This is pretty hard to use, so you may want to assign it to a variable
name:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
cube := x -&gt; x^3
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
You then can use it just like any other function, and it also shows up in
the list of variables on the right-hand side pane.
&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/look-kdes-kalgebra" hreflang="en"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Thu, 13 Sep 2018 12:00:00 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1340089 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Open Axiom</title>
  <link>https://www.linuxjournal.com/content/open-axiom</link>
  <description>  &lt;div data-history-node-id="1338422" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Quadratic_formula.png" width="402" height="124" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Several computer algebra systems are available to Linux users. I
even have looked at a few of them in this column, but for this issue, I discuss
&lt;a href="http://www.open-axiom.org"&gt;OpenAxiom&lt;/a&gt;. OpenAxiom actually is a fork of Axiom. Axiom originally
was developed at IBM under the name ScratchPad. Development started in 1971,
so Axiom is as old as I am, and almost as smart. In the 1990s, it was
sold off to the Numerical Algorithms Group (NAG). In 2001, NAG removed it
from commercial sale and released it as free software. Since then, it has
forked into OpenAxiom and FriCAS. Axiom still is available. The
system is specified in the book &lt;em&gt;AXIOM: the Scientific Computation
System&lt;/em&gt; by Richard Jenks and Robert Sutor. This book is available on-line
at
&lt;a href="http://wiki.axiom-developer.org/axiom-website/hyperdoc/axbook/book-contents.xhtml"&gt;http://wiki.axiom-developer.org/axiom-website/hyperdoc/axbook/book-contents.xhtml&lt;/a&gt;,
and it makes up the core documentation for
OpenAxiom. 
&lt;/p&gt;

&lt;p&gt;
Most Linux distributions should have a package for OpenAxiom.
For example, with Debian-based distributions, you can install
OpenAxiom with:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
sudo apt-get install openaxiom
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
If you want to build OpenAxiom from source, you need to have a
Lisp engine installed. There are several to choose from on Linux, such as
CLisp or GNU Common Lisp. Building is a straightforward:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
./configure; make; make install
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
To use OpenAxiom, simply execute &lt;code&gt;open-axiom&lt;/code&gt; on the command line. This
will give you an interactive OpenAxiom session. If you have a script of
commands you want to run as a complete unit, you can do so with:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
open-axiom --script myfile.input
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
where the file "myfile.input" contains the OpenAxiom commands to be
executed.
&lt;/p&gt;

&lt;p&gt;
So, what can you actually do with OpenAxiom? OpenAxiom has many different
data types. There are algebraic ones (like polynomials, matrices and power
series) and data structures (like lists and dictionaries). You can combine
them into any reasonable combinations, like polynomials of matrices
or matrices of polynomials. These data types are defined by programs in
OpenAxiom. These data type programs also include the operations that can
be applied to the particular data type. The entire system is polymorphic
by design. You also can extend the entire data type system by writing
your own data type programs. There are a large number of different
numeric types to handle almost any type of operation as well.
&lt;/p&gt;

&lt;p&gt;
The simplest use of OpenAxiom is as a calculator. For example, you can
find the cosine of 1.2 with:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/open-axiom" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Tue, 23 Sep 2014 20:56:14 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1338422 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>FreeMat—Yet Another MATLAB Replacement</title>
  <link>https://www.linuxjournal.com/content/freematmdashyet-another-matlab-replacement</link>
  <description>  &lt;div data-history-node-id="1190146" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/11577freef1.jpg" width="550" height="345" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Many programs exist that try to serve as a replacement for
MATLAB. They all differ in their capabilities—some extending beyond
what is available in MATLAB, and others giving subsets of functions that
focus on some problem area. In this article, let's look at another
available option: FreeMat. 
&lt;/p&gt;

&lt;p&gt;
The main Web site for FreeMat is hosted
on SourceForge. Installation for most Linux distributions should be
as easy as using your friendly neighborhood package manager. FreeMat
also is available as source code, as well as installation packages for
Windows and Mac OS X. Once it's installed, you can go ahead and start
it up. This brings up the main window with a working console that
should be displaying the license information for FreeMat (Figure 1).
&lt;/p&gt;

&lt;img src="http://www.linuxjournal.com/files/linuxjournal.com/ufiles/imagecache/large-550px-centered/u1002061/11577freef1.jpg" alt="" title="" class="imagecache-large-550px-centered" /&gt;&lt;p&gt;
Figure 1. When you first start up FreeMat, you are given a fresh console.
&lt;/p&gt;

&lt;p&gt;
As with most programs like FreeMat, you can do arithmetic right away. All
of the arithmetic operations are overloaded to do "the
right thing" automatically, based on the data types of the operands. The core data
types include integers (8, 16 and 32 bits, both signed and unsigned),
floating-point numbers (32 and 64 bits) and complex numbers (64 and 128
bits). Along with those, there is a core data structure, implemented as
an N-dimensional array. The default value for N is 6, but is arbitrary.
Also, FreeMat supports heterogeneous arrays, where different elements are
actually different data types. 
&lt;/p&gt;

&lt;p&gt;
Commands in FreeMat are line-based. This
means that a command is finished and executed when you press the Enter
key. As soon as you do, the command is run, and the output is displayed
immediately within your console. You should notice that results that are
not saved to a variable are saved automatically to a temporary variable
named "ans". You can use this temporary variable to access and reuse
the results from previous commands. For example, if you want to find
the volume of a cube of side length 3, you could so with:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
--&gt; 3 * 3
ans =
 9
--&gt; ans * 3
ans =
 27   
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
Of course, a much faster way would be to do something like this:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
--&gt; 3 * 3 * 3
ans =
 27
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
Or, you could do this:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
--&gt; 3^3
ans =
 27
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
If you don't want to clutter up your console with the output from
intermediate calculations, you can tell FreeMat to hide that output by
adding a semicolon to the end of the line. So, instead of this:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
--&gt; sin(10)
ans =
   -0.5440
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
you would get this:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/freematmdashyet-another-matlab-replacement" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Fri, 15 Nov 2013 21:29:56 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1190146 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Gnuplot—the Grandfather of Graphing Utilities</title>
  <link>https://www.linuxjournal.com/content/gnuplot%E2%80%94-grandfather-graphing-utilities</link>
  <description>  &lt;div data-history-node-id="1084317" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/11414gnuplotf1.jpg" width="600" height="352" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
In these columns, I have covered several different scientific packages for
doing calculations in many different areas of research. I also have 
looked at various packages that handle graphical representation
of these calculations. But, one package that I've never looked at
before is gnuplot (&lt;a href="http://www.gnuplot.info"&gt;http://www.gnuplot.info&lt;/a&gt;). Gnuplot has been around since
the mid-1980s, making it one of the oldest graphical plotting programs
around. Because it has been around so long, it's been ported to most
of the operating systems that you might conceivably use. This month,
I take a look at the basics of gnuplot and show different ways to use it.
&lt;/p&gt;

&lt;p&gt;
Gnuplot is a command-line-driven program. As such,
it has been co-opted to provide graphic capabilities in several other
applications, such as octave. Thus, you may have used gnuplot without even
realizing you were doing so. You can use gnuplot in several ways. 
It not only can accept input data to plot, but it also can
plot functions. Gnuplot can send its output either to the screen
(in both a static file format display or an interactive display), or
it can send output to any of a large number of file formats. 
Additionally, lots of functions are available to customize your plots, changing the
labels and axes, among other things.
&lt;/p&gt;

&lt;p&gt;
Let's start by installing gnuplot. Binaries are available for
many different operating systems. Most Linux distributions also should 
come with a package for gnuplot, so installation should be a breeze. If
you want the latest and greatest features available, you always
can download the source code and build gnuplot from scratch. 
&lt;/p&gt;

&lt;p&gt;
Once gnuplot is
installed, you can start it by executing the command
&lt;code&gt;gnuplot&lt;/code&gt;. When
executed this way, you are launched into an interactive session. Let's
start by trying to plot a basic function. You should be able to plot
any mathematical function that would be accepted in C, FORTRAN or
BASIC. These mathematical expressions can be built up from built-in
functions like &lt;code&gt;abs(x)&lt;/code&gt;, &lt;code&gt;cos(x)&lt;/code&gt;
or &lt;code&gt;Bessel&lt;/code&gt;. You can use integer,
real and complex data types as arguments to these functions. 
&lt;/p&gt;

&lt;p&gt;
When using
gnuplot to generate a plot, you either can have all of the commands in
a single file and hand them in to gnuplot as a script, or you can start
gnuplot up in interactive mode and issue these commands one at a time in
the command environment. To run a gnuplot script, you simply need to add
it at the end of the command when you run gnuplot—for example:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
gnuplot script_to_run
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
When you run gnuplot in interactive mode, you can quit your session
with the command &lt;code&gt;quit&lt;/code&gt;. The two most basic commands
are &lt;code&gt;plot&lt;/code&gt; and
&lt;code&gt;splot&lt;/code&gt;. &lt;code&gt;plot&lt;/code&gt; generates
two-dimensional plots, and &lt;code&gt;splot&lt;/code&gt; generates
three-dimensional plots. To plot a simple function, you can use:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/gnuplot%E2%80%94-grandfather-graphing-utilities" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Mon, 18 Feb 2013 18:48:51 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1084317 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Symbolic Math with Python </title>
  <link>https://www.linuxjournal.com/content/symbolic-math-python</link>
  <description>  &lt;div data-history-node-id="1081822" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/python-logo_1.png" width="601" height="203" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/joey-bernard" lang="" about="https://www.linuxjournal.com/users/joey-bernard" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Joey Bernard&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Many programming languages include libraries to do more complicated
math. You can do statistics, numerical analysis or handle big
numbers. One topic many programming languages have difficulty with is
symbolic math. If you use Python though, you have access to sympy, the symbolic
math library. Sympy is under constant development, and it's aiming to be a
full-featured computer algebra system (CAS). It also is written completely
in Python, so you won't need to install any extra requirements. You
can download a source tarball or a git repository if you want 
the latest and greatest. Most distributions also provide a package for
sympy for those of you less concerned about being bleeding-edge. Once it
is installed, you will be able to access the sympy library in two ways. You
can access it like any other library with the import statement. But, sympy
also provides a binary called isympy that is modeled after ipython.
&lt;/p&gt;

&lt;p&gt;
In its simplest mode, sympy can be used as a calculator. Sympy
has built-in support for three numeric types: float, rational and
integer. Float and integer are intuitive, but what is a rational? A
rational number is made of a numerator and a denominator. So,
Rational(5,2) is equivalent to 5/2. There is also support for complex
numbers. The imaginary part of a complex number is tagged with the
constant I. So, a basic complex number is:
   
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
a + b*I
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
You can get the imaginary part with "im", and the real part with
"re". You
need to tell functions explicitly when they need to deal with complex
numbers. For example, when doing a basic expansion, you get:
   
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
exp(I*x).expand() exp(I*x)
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
To get the actual expansion, you need to tell &lt;code&gt;expand&lt;/code&gt; that it is dealing
with complex numbers. This would look like:
   
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
exp(I*x).expand(complex=True)
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
All of the standard arithmetic operators, like addition, multiplication
and power are available. All of the usual functions also are available,
like trigonometric functions, special functions and so on. Special
constants, like e and pi, are treated symbolically in sympy. They
won't actually evaluate to a number, so something like "1+pi" remains
"1+pi". You actually have to use evalf explicitly to get a numeric
value. There is also a class, called &lt;code&gt;oo&lt;/code&gt;, which represents the concept
of infinity—a handy extra when doing more complicated mathematics.
&lt;/p&gt;

&lt;p&gt;
Although this is useful, the real power of a CAS is the ability to do symbolic
mathematics, like calculus or solving equations. Most other CASes
automatically create symbolic variables when you use them. In sympy, these
symbolic entities exist as classes, so you need to create
them explicitly. You create them by using:
   
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
x = Symbol('x')
y = Symbol('y')
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
If you have more than one symbol at a time to define, you can use:
   
&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/symbolic-math-python" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Wed, 19 Dec 2012 19:19:28 +0000</pubDate>
    <dc:creator>Joey Bernard</dc:creator>
    <guid isPermaLink="false">1081822 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>An Introduction to GCC Compiler Intrinsics in Vector Processing</title>
  <link>https://www.linuxjournal.com/content/introduction-gcc-compiler-intrinsics-vector-processing</link>
  <description>  &lt;div data-history-node-id="1049202" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/math.jpg" width="200" height="167" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/user/801195" lang="" about="https://www.linuxjournal.com/user/801195" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;George Koharchik&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Speed is essential in multimedia, graphics and signal
processing. Sometimes programmers resort to assembly language to get
every last bit of speed out of their machines. GCC offers an intermediate
between assembly and standard C that can get you more speed and processor
features without having to go all the way to assembly language: compiler
intrinsics. This article discusses GCC's compiler intrinsics, emphasizing
vector processing on three platforms: X86 (using MMX, SSE and SSE2);
Motorola, now Freescale (using Altivec); and ARM Cortex-A (using Neon).
We conclude with some debugging tips and references.
&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Download the sample code for this article
here: &lt;a href="http://www.linuxjournal.com/files/linuxjournal.com/code/11108.tar"&gt;http://www.linuxjournal.com/files/linuxjournal.com/code/11108.tar&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;So, What Are Compiler Intrinsics?&lt;/h3&gt;
&lt;p&gt;
Compiler intrinsics (sometimes called "builtins") are like the
library functions you're used to, except they're built in to the
compiler. They may be faster than regular library functions (the
compiler knows more about them so it can optimize better) or handle
a smaller input range than the library functions.  Intrinsics also
expose processor-specific functionality so you can use them as an
intermediate between standard C and assembly language. This gives you
the ability to get to assembly-like functionality, but still let the
compiler handle details like type checking, register allocation,
instruction scheduling and call stack maintenance.  Some builtins are
portable, others are not--they are processor-specific. You can find
the lists of the portable and target specific intrinsics in the GCC
info pages and the include files (more about that below). This
article focuses on the intrinsics useful for vector processing.
&lt;/p&gt;
&lt;h3&gt;Vectors and Scalars&lt;/h3&gt;
&lt;p&gt;
In this article, a vector is an ordered collection of numbers, like
an array. If all the elements of a vector are measures of the same
thing, it's said to be a uniform vector. Non-uniform vectors have
elements that represent different things, and their elements have to be
processed differently. In software, vectors have their own types and
operations. A scalar is a single value, a vector of size one. Code
that uses vector types and operations is said to be vector code. Code
that uses only scalar types and operations is said to be scalar code.
&lt;/p&gt;
&lt;h3&gt;Vector Processing Concepts&lt;/h3&gt;
&lt;p&gt;
Vector processing is in the category of Single Instruction, Multiple
Data (SIMD). In SIMD, the same operation happens to all the data (the
values in the vector) at the same time. Each value in the vector is
computed independently. Vector operations include logic and math. Math
within a single vector is called horizontal math. Math
between two vectors is called vertical math. 
&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/introduction-gcc-compiler-intrinsics-vector-processing" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Fri, 21 Sep 2012 14:00:00 +0000</pubDate>
    <dc:creator>George Koharchik</dc:creator>
    <guid isPermaLink="false">1049202 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
