Rate this Entry
 

Mathematica Memos

Posted May21-12 at 04:24 PM by ChristinaJ

Some basic Mathematica info, mostly to stop myself having to continually research things that I should already know. Basic syntax to start.

(*comment*) code comments should be between (*
“string”a string is defined by quotation marks.
a is an assignment.
2*10^5 standard form (replaces the usual 2e5).
esc phi esc greek letter phi.
Sin[0] functions begin with a capital letter with their arguments in square brackets.
{x1, x2, x3} list of variables. Mathematica often uses “lists” as opposed to vectors/arrays.
ctrl ^/- super/subscript.

Now a little about lists; Mathematica likes data inputs and outputs to be in list form. A list may be defined between curly braces; {x1,x2,x3} for a row vector, and {{x1,x2},{y1,y2}} for a 2 x 2 matrix. Mathematica does not distinguish between a row vector and a 1 x n matrix, neither does it distinguish between a column vector and an n x 1 matrix and so we can define a column vector as {{x1},{x2},{x3}}.

Matrices may be constructed using lists of lists. For example, if we have two row vectors; A={a1,a2,a3} and B={b1,b2,b3} then the 2 x 3 matrix, C may be constructed, where C={A,B}.

Warning – Accidental combination of row and column vectors together will not produce an error. The error will only be made apparent when one attempts to manipulate or act upon the matrix.
Posted in Uncategorized
Views 922 Comments 0 Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments