# ℹ️ Scalar User Manual

## ✔️ 1. About Scalar

Scalar is much more than a scientific calculator. Scalar is a powerful math engine and math scripting language, that combines the simplicity of standard calculators with the flexibility of scripting. Thanks to Scalar scientific calculator, defining arguments and functions, as well as using them in subsequent calculations, expressions and functions graphs, has never been easier. You will see it shortly after getting familiar with available screens and options.

## ✔️ 2. Scalar Menu

To access Scalar App Menu just swipe from the left edge of your screen.

### ✅ 2.1. Menu items

• Calculator – select to enter Scalar Calculator layout.
• Function graph – select to enter Scalar Function Graph layout.
• Scalar Script – select to enter Scalar Script layout.
• Message Log – select to enter the dialog containing list of recent messages displayed to the user (all the messages that are shown above the screen are kept here).
• Settings – select to enter Scalar App settings.
• UI help – select to enter Scalar User Interface Help.
• Video help – select to enter Scalar Video Help.
• Onboarding – select to enter Scalar Onboarding.
• Tutorials – select to check available Scalar Tutorials.
• Health check – select to perform Scalar Math Engine health check.
• Privacy – select to read information on privacy policy.
• About Scalar – select to read information about Scalar App.

## ✔️ 3. Scalar Basics

• Comma “,” acts as parameters separator.
• Dot / Point “.” acts as decimal separator.
• EQ “=” is used for boolean logic, binary relations and definition assigning.
• Press GO button to execute calculation.
• Navigate through Menu, examples and search.

## ✔️ 4. On-boarding screens

### ✅ 4.1. Welcome to Scalar

Please take a moment to learn about the most important functions. Scalar is a powerful math engine and math scripting language, that combines the simplicity of standard tools with the flexibility of scripting.

### ✅ 4.2. Rich calculator &user-defined elements

Thanks to Scalar, defining arguments and functions, as well as using them in subsequent calculations, has never been easier. You will see it shortly after getting familiar with available screens and options.

### ✅ 4.3. Beautiful function graphs

We all know how important visualization is. That is why Scalar provides the ability to create highly personalized function charts.

### ✅ 4.4. Scripts for increased productivity

At Scalar, you can create scripts! Thanks to this, you personalize and automate your work. You can even set a startup script to have your items always at hand.

### ✅ 4.5. Rich functionality available via the menu

Swipe from the left edge to open the menu. The menu provides many additional options, check them all.

### ✅ 4.6. A variety of functions on the each screen

Scalar delivers many useful functions and shortcuts. Study the layout of screens, detailed maps can be found in the help menu.

### ✅ 4.7. Search in several hundred mathematical elements

Scalar provides several hundred mathematical elements, including many functions and constants. Use a convenient search available on long press of “example / help” button.

### ✅ 4.8. Control the Scalar through application options

Familiarize yourself with options to control the behavior of the application, as well as the configuration of the mathematical engine.

### ✅ 4.9. Scalar communicates with the user

Scalar communicates with the user. If there is not enough time to read the message, you find all the details in the message log.

### ✅ 4.10. Thank you for using Scalar

I wish you great experience using Scalar. If necessary, please contact me, you can find all the information in the application menu – about section.

### ✅ 4.11. After On-boarding it is recommended to learn the screen layouts

At the end of the On-boarding Scalar is going to ask a question “Reading screen maps is highly recommended. Should I open additional help?”. It is strongly recommended to understand the layouts as Scalar provides really many features.

## ? 5. Detailed screen maps

Reading screen maps is highly recommended. On-boarding process strongly recommends going through them. At any time you can access “UI Help” via Scalar App menu bar.

### ✅ 5.1. Scalar provides a truly new experience via well designed layouts

A truly new experience! Rich functions set provided in a beautiful design! This is very advanced math engine! Scientific Calculator is really new in its category as it provides new natural syntax.

### ✅ 5.2. Calculator screen layout

Calculator Screen – please take a moment to recognize the variety of options. Scalar gives a lot of flexibility, its syntax enables definition of user elements in almost natural math language. Please refer to the EXAMPLE button.

• Expression View – entered command appears in a scroll able text box.
• Horizontal & Vertical Scroll – a plenty of space for your math calculations.
• Reusable Results – results of calculated expressions are assigned to automatically created constants.
• User Input – define & evaluate user elements such as arguments, functions & constants.
• Easy Navigation – modify your expressions using cursors / delete buttons, no need to use device keyboard.
• Commands History – easy navigation through command history using cursors.
• Math Operators – most important math operators easily accessible.
• Sigma Summation & Pi Product – most important iterated operators.
• Letters & Other Operators – lower letters available via keyboard swipe.
• Math Function – rich set of math functions accessible from standard layout, the rest through help/search dialog.
• Screen Clear – clear current command or current results view.
• On Long Layout – each button has another smart function after long click, press “on long” for help.
• Execute – do not hesitate to try any command clicking GO button.
• Clear – clear user input.
• Share Results – share your calculation results via SMS, e-mail, Facebook & others.
• Learn on Examples – a plenty of examples available to present Scalar syntax.

### ✅ 5.3. Calculator ON LONG screen layout

Calculator On Long click layout. Each button hides something smart when long pressed. This boosts convenience, try it out. To see what is hidden press ON LONG button.

• Expression View – entered command appears in a scroll able text box.
• Horizontal & Vertical Scroll – a plenty of space for your math calculations.
• Reusable Results – results of calculated expressions are assigned to automatically created constants.
• User Input – define & evaluate user elements such as arguments, functions & constants.
• Easy Navigation – modify your expressions using cursors / delete buttons, no need to use device keyboard.
• Commands History – easy navigation through command history.
• Math Operators – most important math operators easily accessible.
• Sigma Summation & Pi Product – most important iterated operators with step option accessible from layout.
• Letters & Other Operators – upper letters available via keyboard swipe.
• Math Function – Even richer set of math functions accessible from standard layout, on long click you get additional syntax.
• Screen Clear – clear current command or current results view.
• On Long Layout – each button has another smart function after long click, press “on long” for help.
• Execute History – press long on GO to see the history of command that were recently executed..
• Share Results – share your calculation results via SMS, e-mail, Facebook & others.
• Math Syntax Help – search through Scalar math library, Scalar implements few hundred math elements .

### ✅ 5.4. Calculator screen – Basics

• Comma “,” acts as parameters separator.
• Dot / Point “.” acts as decimal separator.
• EQ “=” is used for boolean logic, binary relations and definition assigning.
• Press GO button to execute calculation.

### ✅ 5.5. Function graphs / charts screen

Function Graphing – simple, yet powerful graph generator! It is enough tu put single expression as all parameters can use its default configuration. In case of need everything can be carefully tailored.

• A truly new experience – tailor graphs to your needs, use rich math library.
• Variable Definition – enter variable name, its range and calculation density.
• Automatic Legend – switch on / switch off.
• Up to 3 Expressions – the Heart of the Scalar Graph – a powerful math engine.
• Graph X/Y MIN/MAX – in case you need more control define graph area.
• Series Colors – click to select your favorite color, long click to load default series color.
• Line / Points Series – choose whether you plot line series or points series.
• Density Per Series – some scenarios require different points density per series, leave empty for default
• Fully Interactive Charts – beautiful plots, fully interactive: scale, swipe.
• Scale X / Scale XY – graph is fully interactive, select mode you currently want to use.
• Show Value on Motion – if enabled each touch on graph presents series values for X value pointed by finger.
• Clear / Undo Clear – easily clear elements or undo recent clear via long click.
• Execute Drawing – draw or refresh your graph.
• Open / Save Graph – save your work, reuse it in the future.
• Share Graph – share graph image and / or reusable graph definition in plain text.
• Learn on Examples – a plenty of examples available to present Scalar Graph syntax.

### ✅ 5.6. Scripting screen

Math Scripts– Scalar is basically a programming language! Very convenient in syntax, i.e. check “x = 2”. Load some examples to learn more.

• Simple Math Syntax – just try “x = 2” .
• Script Editor – convenient script editing, syntax highlighting, code auto completion.
• Script Name – plus script modified but not saved indication.
• Auto-Completion – code auto completion available as you write.
• Script Line Numbers – script execution errors point to the line number.
• Change Active Line – navigate through script lines, run selected line, press long to select first / last script line
• Undo / Redo – revert changes done to the code.
• Script Results View – entered command appears in a scroll-able text box, horizontal / vertical scroll is supported.
• Execute Script – execute entire script.
• Execute Single Line – interact with script code by fixing and executing just selected line.
• Clear Results / Script – clear result window, press long to clear script editor
• Open / Save – save your work, reuse it in the future. Long press “OPEN”  to paste graph definition from the clipboard .
• Share Scripts / Results – share script text and / or script result.
• Learn on Examples – a plenty of script examples available to present Scalar  syntax.

## ✔️ 6. Tips displayed by the Scalar App

Scalar Calculator App has built-in system of helping for the user to familiarize with the app logic. This is done on user interaction. Scalar uses interaction context to display tips / hints. Messages are appearing and disappearing, thus you can always read them in the message log. Additionally you can adjust the Scalar setting to force always show hint behavior, otherwise one tip is presented only once.

### ✅ 6.1. General Tips

• Tip: Remember that the details of all displayed messages can be found in the message log – just swipe from left edge.

### ✅ 6.2. Tips on Calculator layout

• Tip: Each result is assigned to a new constant. This is to help you use previous values in subsequent calculations. The last result automatically appears at the beginning of the next expression. You can change this behavior in the options. Regardless of the option, it is always possible to use all previous results on your own, just use the appropriate name.
• Tip: You have just used functions based on prime numbers, check application options in the field of caching prime numbers, this can significantly accelerate the calculation.
• Tip: Remember that the comma is used as a function parameter separator. Use a dot/point as the decimal separator.Tip: To open context help for supported functions, use a long click on the example button.
• Tip: To open context help for supported functions, use a long click on the example button.
• Tip: A long click on the cursor button moves to start or end respectively.
• Tip: If you want to use a system keyboard, use a long click on the expression editing field.
• Tip: You have just been presented with the result in scientific notation. This can be changed in application options.
• Tip: This is just a help showing on long keyboard layout. To use on long function press long click on a selected button, no need to keep \’on long\’ button pressed.
• Tip: Press long in order to clear everything to the left.
• Tip: Underscore can be used in the names like x_1 as well as for entering fractions like 1_2 or 2_3_4
• Tip: Inverse trigonometric functions can be found under a long click.
• Tip: Hash # is a modulo operator.
• Tip: At @ can be used for bitwise operators, e.g. @>>
• Tip: Square brackets are not interpreted as brackets in calculations. They are used to distinguish some mathematical expressions, e.g. units [km], or some constants, e.g. as the speed of light.
• Tip: Scalar was created by a mathematician, so it could not miss “/\”‘ and “\/” as logical conjunction (and) plus disjunction (or) respectively.
• Tip: Ampersand is interpreted as logical conjunction (and).
• Tip: Pipe is interpreted as logical disjunction (or).
• Tip: Percent syntax: 5%, 20 * 5%, 10% * 120
• Tip: Exclamation can be used as factorial 5!, (x-y)!, or as inequality relation x != 2, 5 != 5.
• Tip: Tilde is used for negation, i.e.: ~(x = y), x ~/\ y
• Tip: Press long to clear the results window.
• Tip: Press long to show commands history.
• Tip: Feel free to scroll results windows.
• Tip: Numerical solve of f(x) = 0 in the range (a,b). This is a Brent\’s bracketing method, which means that sign of the f(a) must be the opposite to sign of f(b).
• Tip: Letter long click gives uppercase. Letters are used to enter names (functions, variables). Please notice that letter are also handy to enter numbers in other numerical systems, i.e. h.12af2 (hex), b19.12gfh (base 19).
• Tip: Please note that you have an extended keyboard accessible via horizontal swipe. You will find there additional operators, letters, and functions. To remind about it on every application launch swipe is animated. This can be disabled in the application options.

### ✅ 6.2. Tips on Function Graph layout

• Tip: X/Y min/max values affect only the area of the graph, to calculate additional data modify the range from/to properties.
• Tip: Range from/to values affect range of the series data calculation, to modify just the area of the graph set X/Y min/max properties.
• Tip: You are modifying the global density of series points. To set different density separately for each series, use series specific “by” parameters.
• Tip: You are modifying series specific points density. To set global density for all series, use generic “by” parameter.
• Tip: Each parameter can be given as a number or a corresponding mathematical expression. Scalar then calculates final parameter value.
• Tip: When defining a series, you can use all elements defined by yourself, as well as the entire mathematical library that is provided by Scalar. It will be easier for you to choose the right syntax if you press long “help / search” button.
• Tip: Series type selector: line vs points. In case you use points please note that points density might cause that the effect will not be visible. You can always adjust the scale by zoom in or by changing density parameters.
• Tip: Fast parameter text clearing. To UNDO, press long the same button.
• Tip: The cursor allows you to read the series data on chart touch and finger motion.

### ✅ 6.3. Tips on Scalar Script layout

• Tip: Great, you start creating scripts. This can significantly speed up your work with Scalar. Remember that in the application options you can set the startup script.
• Tip: Running a single line of the script makes it much easier to find errors. The up / down cursor keys are also very helpful. Use them to set active line of the code.
• Tip: Long press moves to start / end respectively. The up / down cursor keys are very helpful to set line of the code that is active. After selecting, pres “run line” button.
• Tip: A long press on the button clears the script editor.

## ✔️ 7. User arguments definition

Defining user arguments and constants is what makes Scalar unique in the panorama of available calculators. Take a moment to familiarize yourself with this short tutorial. It is definitely a dose of very useful knowledge.

### ✅ 7.1. Simple user arguments definition

In Scalar you can simply write x = 2, y = 2 * x, etc. Try it yourself. Pay particular attention to the fact that when defining the argument y, which depends on the argument x, the change in the value of x affects the value of y. In other words, Scalar remembers the expressions that define the arguments and uses these expressions at the time of requesting the value.

Scalar code result:

scalar > x = 2
scalar > x
e1 = 2
scalar > 2*x + 4
e2 = 8
scalar > y = 2*x + 4
scalar > y
e3 = 8
scalar > x = 3
scalar > y
e4 = 10


Scalar script:

x = 2
x
2*x + 4
y = 2*x + 4
y
x = 3
y


### ✅ 7.2. Arguments multi-dependencies

In terms of dependencies between arguments Scalar does not define any restrictions. You can create wide and deep dependency trees. This is well illustrated by the example below.

Scalar code result:

scalar >; a = 3
scalar > b = 3*a + 2
scalar > c = a*b
scalar > d = a + b + c
scalar > d
e1 = 47
scalar > a = 4
scalar > d
e2 = 74
scalar > a = 5
scalar > d
e3 = 107


Scalar script:

a = 3
b = 3*a + 2
c = a*b
d = a + b + c
d
a = 4
d
a = 5
d


In certain situations, it is convenient to check how user elements are defined. Use the list command to do this.

list

Please note that Scalar assigns the results of the calculations to the constant, while the arguments are marked separately.

Scalar code result:

scalar > list
Type       Name/Value
----       ----------
Constant:  e1 = 47.0 -----    d
Constant:  e2 = 74.0 -----    d
Constant:  e3 = 107.0 -----    d
Argument:  a = 5.0 -----    a = 5
Argument:  b = 17.0 -----    b = 3*a + 2
Argument:  c = 85.0 -----    c = a*b
Argument:  d = 107.0 -----    d = a + b + c


Scalar script:

list


You can also use context help to verify the elements definition. Long click on the “example /?” button, then in the dialog select the user items.

### ✅ 7.3. User arguments vs user constants

The difference between the user constant and the user argument is fundamental. The constant only remembers the value, the argument remembers the expression, thanks to which the value can be calculated. You can define your own constant by adding the const command at the beginning.

const def

Scalar code result:

scalar > x = 3
scalar > const y = x^2
scalar > y
e1 = 9
scalar > x = 10
scalar > y
e2 = 9
scalar > list
Type       Name/Value
----       ----------
Constant:  y = 9.0 -----    y = x^2
Constant:  e1 = 9.0 -----    y
Constant:  e2 = 9.0 -----    y
Argument:  x = 10.0 -----    x = 10


Scalar script:

x = 3
const y = x^2
y
x = 10
y
list


## ✔️ 8. User functions definition

Functions for mathematics are what elementary particles are for physics. For this reason, the Scalar Calculator and its mathematical engine, provide the syntax for defining user functions, which is as close to natural as possible. Just enter f (x) = x^2 and you are ready to go.

### ✅ 8.1. Basic user defined functions

The syntax for defining user functions is as follows.

FunctionName(param1 <, param2, …>) = expression

It is much easier to understand this on the basis of an example – it is really easy. Please note that you can easily define a function depending on the function you have already defined. It gives you great flexibility.

Scalar code result:

scalar > f(x) = sqrt(x)
scalar > g(x) = f(x)^2
scalar > h(x) = g(x)^2
scalar > h(4)
e1 = 16
scalar > g(4)
e2 = 4
scalar > f(4)
e3 = 2
scalar > Showing command history


Scalar script:

f(x) = sqrt(x)
g(x) = f(x)^2
h(x) = g(x)^2
h(4)
g(4)
f(4)


I am sure, that from time to time, you will want to check what you have already defined. This is possible using context help. Long click on the “example /?” button, then select the user items option.

### ✅ 8.2. Drawing charts of user defined functions

Each defined function is available in the Scalar namespace. Nothing prevents you from referring to these names anywhere in the application. In particular, it allows you to draw graphs of your own functions.

### ✅ 8.3. User defined functions with many parameters

Nothing special in this case as Scalar has no restrictions. Simply use the similar syntax to the presented in the below example.

Scalar code result:

scalar > f(x,y) = sin(x) + cos(y)
scalar > f(pi/6, pi/4)
e1 = 1.2071067811865475
scalar > 1/2 + sqrt(2)/2
e2 = 1.2071067811865475
scalar > f(x,y,z) = x*y*z
scalar > f(1,2,3)
e3 = 6
scalar > f(4,5,f(1,2,3))
e4 = 120


Scalar script:

f(x,y) = sin(x) + cos(y)
f(pi/6, pi/4)
1/2 + sqrt(2)/2
f(x,y,z) = x*y*z
f(1,2,3)
f(4,5,f(1,2,3))


### ✅ 8.4. Variadic user defined functions

Scalar provides a special syntax for defining functions with any (variable) number of parameters.

FunctionName(…) = expression

“(…)” is obligatory as it indicates that you create function with variable number of parameters.

Additionally Scalar provides special keywords that help to build expression defining variadic functions.

• [npar] – number of parameters provided by the user on calculation request
• par(i) – value of parameter at index “i”

Please refer to the below example

Scalar code result:

scalar > f(...) = [npar]
scalar > f(2)
e1 = 1
scalar > f(3,1)
e2 = 2
scalar > f(4,2,5,6)
e3 = 4
scalar > f(...) = sum(i,1,[npar],par(i))
scalar > f(1,2,3,4,5)
e4 = 15
scalar > 1+2+3+4+5
e5 = 15


Scalar script:

f(...) = [npar]
f(2)
f(3,1)
f(4,2,5,6)
f(...) = sum(i,1,[npar],par(i))
f(1,2,3,4,5)
1+2+3+4+5


## ? 9. Built-in Examples

### ✅ 8.3. Built-in examples – Scalar Calculator

• Example: Basic calculation decimal numbers – basic calculation using decimal numbers and brackets.
• Example: Using built-in functions – using built-in functions, scalar provides few hundred math functions.
• Example: Defining user argument – user argument definition based on expression and other possible arguments / functions.
• Example: Defining user function – user function definition based on expression and other possible constants / functions.
• Example: Defining user function more parameters – user function with more parameters definition based on expression and other possible constants / functions.
• Example: Random numbers generation – random number generation based on different options.
• Example: Defining user random variable – user random variable definition based on random number and other expression, constants, functions.
• Example: Defining user constant – user constant definition based on expression and other elements, constants can be referenced from user functions.
• Example: Σ summation operator – Σ summation iterated operator.
• Example: Π product operator – Π product iterated operator.
• Example: Numerical derivative – numerical derivative operator, sine function.
• Example: Numerical integral – numerical integral operator, circle area.
• Example: To hexadecimal conversion – expression result converted to hexadecimal representation.
• Example: To binary conversion – expression result converted to binary representation.
• Example: Various numeral bases – expression result converted to selected numeral base representation.
• Example: To fractions conversion – expression result converted to fractions representation.
• Example: Fractions in expression – fractions used in expression, result as decimal.
• Example: Hexadecimal in expression – hexadecimal used in expression, result as decimal.
• Example: Binary in expression – binary used in expression, result as decimal.
• Example: Any numeral base in expression – number in any numeral based used in expression, result as decimal.
• Example: Prime factorization – expression result converted to prime factors representation.
• Example: Scientific notation – using numbers in scientific notation, various forms.
• Example: If condition function – calculation with conditions – basic if else.
• Example: If with more conditions – calculation with conditions – more conditions.
• Example: Variadic user function – variadic user function definition based on expression and other possible constants / functions.
• Example: Boolean logic – Boolean logic operators.
• Example: Bitwise operators – example of using bitwise operators.
• Example: Solving equations – numerical solving of equations f(x) = 0.
• Example: Repeat expression for a variable range – repeating expression calculation for a given variable and provided variable range.
• Example: Repeat multiple expressions for a variable range – repeating multiple expressions calculation for a given variable and provided variable range.
• Example: Repeat expression for a variable range using by step – repeating expression calculation for a given variable and provided variable range using by incremental step.

### ✅ 8.2. Built-in examples – Functions Graphs

• Example: Sine and cosine lines – basic graph of trigonometric functions, just few options used.
• Example: Trigonometric lines and points – lines and points on one graph, tangent function is generating extreme values near to its roots, scalar truncates this data.
• Example: Circle – two series in the same color, as a result nice circle shape.
• Example: Heart formula – beautiful math formula, two series in the same color, as a result love shape.
• Example: White noise uniform U(0,1) – random numbers in time, series presented as lines.
• Example: PDF normal N(0,1) + noise – standard normal distribution, probability distribution function + random numbers in time presented as points.
• Example: Prime-counting Pi(n) + approx – prime counting function Pi(n) between its approximations by logarithmic integral “li(n)” and Gauss/Legendre “n/ln(n)”.
• Example: Number e sequence limit – presentation how sequence “(1+1/n)^n” is getting closer to “e”.

### ✅ 8.3. Built-in examples – Scalar Scripts

• Example: Basic calculations – basic math calculation, argument definition, changing argument value, printing values.
• Example: User functions – user functions definition, calculating function value.
• Example: Built-in functions – some examples of using built-in functions in scalar script.
• Example: Summation operator – sigma summation iterated operator, example of usage in scalar script.
• Example: Product operator – Pi product iterated operator, example of usage in scalar script.
• Example: User constants – user constant used in function body, but not present in functions parameters.
• Example: Simple recursion – factorial implemented as user defined recursive function.
• Example: Indirect recursion – sophisticated example of combining constants, functions and recursion to approximate sin(x) and cos(x).
• Example: Repeat expression for a variable range – repeating expression calculation for a given variable and provided variable range using by incremental step.