100% found this document useful (1 vote)
59 views4 pages

SOMAS Syntax Guide for Input Errors

The SOMAS Syntax instructions provide guidelines for entering mathematical expressions correctly, emphasizing the importance of using specific symbols for numbers, multiplication, powers, brackets, functions, and matrices. Users are advised to use proper notation such as 'pi' for π, 'e' for e, and to utilize brackets to avoid ambiguity in expressions. Additionally, the document outlines how to enter equations, inequalities, and sets, while noting that SOMAS uses radians for trigonometric functions and allows for both natural logarithms and exponentials to be expressed in a specific format.

Uploaded by

hesbononounga
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
59 views4 pages

SOMAS Syntax Guide for Input Errors

The SOMAS Syntax instructions provide guidelines for entering mathematical expressions correctly, emphasizing the importance of using specific symbols for numbers, multiplication, powers, brackets, functions, and matrices. Users are advised to use proper notation such as 'pi' for π, 'e' for e, and to utilize brackets to avoid ambiguity in expressions. Additionally, the document outlines how to enter equations, inequalities, and sets, while noting that SOMAS uses radians for trigonometric functions and allows for both natural logarithms and exponentials to be expressed in a specific format.

Uploaded by

hesbononounga
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOMAS Syntax instructions

SOMAS tries quite hard to give helpful information about any syntax errors. It
might also forgive some errors you make. However, the syntax in SOMAS is
broadly easy and you will find it useful to master it.

Numbers

You should type in numbers without spaces, and use fractions rather than
decimals where possible. For example, 1/41/4 should be entered as 1/4, not
as 0.25. Also,

 ππ is entered as either pi or by %pi,


 ee, the base of the natural logarithms, is entered as either e or by %e,
 ii is entered as either i or by %i.

o You could also use sqrt(-1), or (-1)^(1/2), being careful with the
brackets.
o SOMAS modifies SOMAS's normal input rules so that you don't get
caught out with a variable i when you meant %i.
 You can also use scientific notation for large numbers, e.g. 10001000 can
be entered as 1E+3. Note, however, that in many situations floating point
numbers are forbidden.

Multiplication

Use a star for multiplication. Forgetting this is by far the most common source of
syntax errors. For example,

 3x3x should be entered as 3*x.


 x(ax+1)(x−1)x(ax+1)(x−1) should be entered as x*(a*x+1)*(x-1).

SOMAS does sometimes try to insert stars for you where there is no
ambiguity, 2x or (x+1)(x-1). This guessing cannot be perfect since traditional
mathematical notation is sometimes ambiguous!
Compare f(x+1)f(x+1) and x(t+1)x(t+1).

Powers

Use a caret (^) for raising something to a power: for example, x2x2 should be
entered as x^2. You can get a caret by holding down the SHIFT key and pressing
the 6 key on most keyboards. Negative or fractional powers need brackets:

 x−2x−2 should be entered as x^(-2).


 x1/3x1/3 should be entered as x^(1/3).
Brackets

Brackets are important to group terms in an expression. This is particularly the


case in SOMAS since we use a one dimensional input rather than traditional
written mathematics. Try to consciously develop a sense of when you need
brackets and avoid putting in too many.

For example,

a+bc+da+bc+d

should be entered as (a+b)/(c+d).

If you type a+b/(c+d), then SOMAS will think that you mean

a+bc+d.a+bc+d.

If you type (a+b)/c+d, then SOMAS will think that you mean

a+bc+d.a+bc+d.

If you type a+b/c+d, then SOMAS will think that you mean

a+bc+d.a+bc+d.

Think carefully about the expression a/b/c. What do you think this means? There
are two options

ab⋅1c=abcorabc=[Link]⋅1c=abcorabc=acb.

SOMAS interprets this as abcabc. If in doubt use brackets.

Note that in this context you should always use ordinary round bracket (like
(a+b)), not square or curly ones (like [a+b] or {a+b}).

 {a+b} means a set,


 [a+b] means a list.

More examples

 2a+b2a+b should be entered as 2^(a+b)


 2cos3x2cos⁡3x should be entered as 2*cos(3*x)
 eaxsin(bx)eaxsin⁡(bx) should be entered as e^(a*x)*sin(b*x)
 (ax2+bx+c)−1(ax2+bx+c)−1 should be entered as (a*x^2 + b*x + c)^(-
1).
Functions
 Standard functions: Functions, such
as sinsin, coscos, tantan, expexp, loglog and so on can be entered using
their usual names. However, the argument must always be enclosed in
brackets: sinxsin⁡x should be entered as sin(x), ln3ln⁡3 should be entered
as ln(3) and so on.
 Modulus function: The modulus function, sometimes called the absolute
value of x, is written as |x| in traditional notation. This must be entered
as abs(x).

Trigonometrical functions

Things to remember:

 SOMAS uses radians for the angles not degrees!


 The function 1/sin(x)1/sin⁡(x) must be referred to as csc(x) rather
than cosec(x) (or you can just call it 1/sin(x) if you prefer).
o sin2xsin2⁡x should be entered as sin(x)^2 (which is what it really
means, after all). Similarly for tan2(x)tan2⁡(x), sinh2(x)sinh2⁡(x) and
so on.
o Recall that sin−1(x)sin−1⁡(x) traditionally means the number tt such
that sin(t)=xsin⁡(t)=x, which is of course completely different from
the number sin(x)−1=1/sin(x)sin⁡(x)−1=1/sin⁡(x). This traditional
notation is really rather unfortunate and is not used by the CAS;
instead, sin−1(x)sin−1⁡(x) should be entered as asin(x).
Similarly, tan−1(x)tan−1⁡(x) should be entered as atan(x) and so on.

Exponentials and Logarithms

 You should always write exp(x). Typing e^x should work in SOMAS.
 Currently in SOMAS both lnln and loglog are the natural logarithms with
base e≈2.71⋯e≈2.71⋯. Note that both of these start with a lower case l,
not a capital I.
 Log to base 1010 is entered as lg.

Matrices
You may be given a grid of boxes to fill in. If not, the Lecturer may provide a hint
as to the correct syntax. Otherwise you will need to use SOMAS's notation for
entering the matrix.

The matrix:
(142536)(123456)

must be entered as matrix([1,2,3],[4,5,6]).

Each row is entered as a list, and these should be the same length. The function
matrix is used to indicate this is a matrix and not a "list of lists".

Equations and Inequalities

Equations can be entered using the equals sign. For example, to enter the
equation y=x2−2x+1y=x2−2x+1 type y=x^2-2*x+1.

Inequalities can be entered using the greater than and less than signs on the
keyboard. Notice that there are four possibilities for you to choose
from: < or > or <= or >=. Note there is no space between these symbols, and the
equality must come second when it is used, i.e. you cannot use =<.

Sometimes you will need to connect inequalities together as x>1 and x<=5. You
must use the logical connectives and and or. "Chained inequalities" such
as 1<x<51<x<5 are not permitted as input syntax. You should enter this
as 1<x and x<5.

Other notes
 Greek letters can be entered using their English names. For example,
enter α+βα+β as alpha+beta, and 2π2π as 2*pi.
 Sets: To enter a set such as {1,2,3}{1,2,3} in SOMAS you could use the
function set(1,2,3), or use curly brackets and type {1,2,3}.
 Lists: can be entered using square brackets. For example, to enter the
list 1,2,2,3 type [1,2,2,3].

Common questions

Powered by AI

In SOMAS, matrices are entered using the matrix function which requires each row to be specified as a list, such as matrix([1,2,3],[4,5,6]). This syntax differs from traditional matrix notation which uses a grid of numbers. Consistency in syntax is important to prevent SOMAS from misinterpreting the matrix as a collection of lists rather than a structured matrix .

In SOMAS, standard functions like sin, cos, and tan must have their arguments enclosed in brackets (e.g., sin(x)). Inverse trigonometric functions use asin(x), atan(x), rather than the traditional sin^-1(x), tan^-1(x), which could be misinterpreted as reciprocal functions. This notation ensures clarity and prevents confusion with traditional notations like sin(x)^-1, which means 1/sin(x).

In SOMAS, fractions should be typed without spaces, such as 1/4, instead of using decimals like 0.25. Using fractions rather than decimals can be beneficial in SOMAS because floating point numbers are often forbidden in certain contexts, helping maintain precision in mathematical calculations .

In SOMAS, exponentials are typically input using exp(x) or alternatively as e^x. For logarithms, both ln and log represent natural logarithms with base e, and must not be capitalized. Logarithms to base 10 are entered as lg. Understanding these distinctions ensures accurate input of exponential and logarithmic expressions .

SOMAS requires inequalities to be input with precise syntax: <, >, <=, >=, without spaces. Inequality chains like 1<x<5 need separate logical connectives, e.g., 1<x and x<5. This non-traditional requirement prevents inaccuracies caused by ambiguity found in chained inequalities, ensuring clear and precise input .

In SOMAS, sets are written using either the set function, set(1,2,3), or curly brackets, {1,2,3}, while lists are enclosed in square brackets, [1,2,2,3]. Failing to observe these conventions could lead to misinterpretation of input data, as the system distinguishes inputs by these syntax rules for data classification .

In SOMAS, powers are denoted using a caret (^). For expressions with multiple operations, brackets are crucial in indicating operation precedence, as SOMAS uses a one-dimensional input similar to a linear format. Incorrect or excessive use of brackets can lead to misinterpretation of the expression's intended mathematical order, such as in (a+b)/(c+d) versus a+b/c+d .

Greek letters are entered in SOMAS using their English names, such as alpha for α and pi for π. This facilitation aids in quick and intuitive input of complex mathematical expressions. However, it requires users to be familiar with the English representation, which might hinder users accustomed to symbolic input, necessitating awareness of translation between symbolic and alphanumeric syntax .

In SOMAS, multiplication is denoted using a star (*) symbol. Users must include this symbol to avoid syntax errors, such as typing 3*x instead of 3x. A common user error is omitting the star, leading SOMAS to potentially misinterpret expressions .

In SOMAS, large numbers can be expressed using scientific notation, such as 1E+3 for 1000. However, many contexts within SOMAS prohibit floating point numbers, thus potentially restricting the use of scientific notation to avoid rounding errors and maintain exact arithmetic operations, which affects precision in calculations .

You might also like