slcalc‎ > ‎

slcalc iPad (v.1.5)


Contents
1. Views of slcalc
2. Using as a simple calculator
3. Using variables and functions
4. Editing variables and functions
5. Writing program
6. Changing format
7. Using 2nd Keys
8. Input through Internet
9. Changing precision
10. Changing key layout

1. Views of scalc



[17.settings]



2. Using as a simple calculator

Entering [2.input text] by [1.key] or software keyboard, tap [3.enter]. The calculation result appears in [4.calculation result]. When calculation result is too long, page number such as 0: appears at the most left, and the succeeding pages can be displayed by tapping inside [4.calculation result]. 

When you want to correct [2.input text], move cursor using [13.cursor movement], delete characters by [5.backspace], and insert correct characters.

When you recall previous input texts, tap [9.recall] and [10.backrecall].

examples:
2*(3-4/2)+3[Ent]
2^-4[Ent]

3. Using variables and functions

To define variable, input name=expression[Ent].
example: q=1.6e-19[Ent]

The first character of name should be alphabet. The succeeding characters are alphabet or digits. Upper and lower case characters are treated as same characters. The first 64 characters are distinguished. The value of undefined variable is 0.

To define function, input name(argument)=expression[Ent].
example: f(x)=2*x^2+1[Ent]

The maximum number of argument is 8.
example: f(x1,x2,x3,x4,x5,x6,x7,x8)=x1+x2+x3+x4+x5+x6+x7+x8

Variable is evaluated at its definition, whereas function is evaluated at its usage. For example,
a=2
b=3*a
f(x)=a*x^2+1
a=3
Then, b is equal to 6, and f(3) becomes 28.

After the definition of variable or function, the name appears in [14.variable/function selection]. You can input variable and function into [2.input text] by tapping the name in [14.variable/function selection].

To use array of variable or function, add [suffix] after the name.
example: a[3]m[2,4]f[1](x,y)
The dimension of array is unlimited. Suffix can be negative integer.
example: a[-2,3,0,-4,1,7]

4. Editing variables and functions

Variables and functions can be edited and deleted using [16.edit variables and functions]. 
Tap a variable or function name, then, the content appears in [2.input text]. Tap [done], then, you can edit expression and enter by tapping [3.enter]. If you want to escape without editing, tap [5.backspace].

When you want to remove variable or function, tap green check button to change it to gray button. Green check means that the name remains after tapping [done]. On the other hand,  names of gray check are removed after tapping [done]. If you want to escape without removing any variables and functions, tap [6.clear input text]. 

5. Writing program

You can write program using if-then-else, while, etc. The following example is to calculate integral of f(x) between xs and xe with the number of intervals, n.

integral(xs, xe, n) = (
  dx=(xe-xs)/n
  s=i=0
  while i lt n (
    s=s+f(xs+dx*(i+0.5))
    i=i+1
  )
  s*dx
)

In this case, variables dx, s, and i are defined in the function. When the function is called, dx, s, and i are defined, and appear in [14.variable/function selection]. When you want to use variables and functions invisible in [14.variable/function selection], use temporary variables and functions. The first character of name of temporary variables and functions is $. The succeeding characters are alphabets or digits. As an example, the above function is rewritten using temporary variables.   

integral(xs, xe, n) = (
  $dx=(xe-xs)/n
  $s=$i=0
  while $i lt n (
    $s=$s+f(xs+$dx*($i+0.5))
    $i=$i+1
  )
  $s*$dx
)

Temporary variables and functions will be removed when [done] is tapped in [16.edit variables and functions].

6. Changing format

The format of [4.calculation result] can be changed by [7.format]. Taping it, n is changed to f, f is changed to e, and e is changed to n, where
  n: shorter format between f and e
  f: decimal notation of the form [-]mmm.ddd
  e: decimal notation of the form [-]m.dddexx

The formats can be defined at [17.settings]-[20.format]. For the calculation result part,
  %[flags][width.precision][format][/base]
where
  [flags]
    , : thousands separator
    + : number will always be printed with a sign
    - : left adjustment
    t : engineering notation
  [format]
    fF : decimal notation of the form [-]mmm.ddd, where the number of 's is specified by the precision. The default precision is 6; a precision of 0 suppresses the decimal point.
    eE : decimal notation of the form [-]m.dddexx or  [-]m.dddExx , where the number of 's is specified by the precision. The default precision is 6; a precision of 0 suppresses the decimal point.
    gG : %e or %E is used if the exponent is less than -4 or greater than or equal to the precision; otherwise %f or %F is used. Trailing zeros and a trailing decimal point are not printed.

example: %,.3f
example: 0x%.0F/16

A very special format is %i , which prints all significant digits in 10 base. Flags, width, precision and base are ignored. Shorter format between f and e is employed after removing trailing zeros and a trailing decimal point.


The font size of [4. calculation result] can be specified by min-max range, like 20-28 as shown below. Most suitable font size is employed within the range. Different font size can be specified to each view of portrait and landscape.



7. Using 2nd Keys

You can define second keys for [1.key]. Tap [8.2nd key] to change key to 2nd.

2nd keys can be defined at [17.settings]-[26.edit 2nd key]. Select [36.key Id selection], then, key Id appears at [33.key Id]. Edit [34.key name] which is displayed on 2nd key, and [35.key string] which is inputted to [2.input text].

In [35.key string], you can use the following special functions
  # : [Ent]
  $ : number of expressions at last [Ent]
  $[0]$[1], ..., $[$-1]: calculation results at last [Ent]

As an example,

key name: m
key string: #$1=$2=0 while $1 lt $ ($2=$2+$[$1] $1=$1+1) $2/$#{mean}

3 6 1 4 [m] returns the mean value 3.5. In this case, $=4, $[0]=3, $[1]=6, $[2]=1, $[3]=4.

8. Input through Internet

Input texts and 2nd keys can be loaded through Internet. Make a web file with following fields,

  slcalc [2.input text]
  KeyId [33.key Id]
  KeyName [34.key name]
  KeyString [35.key string]

An example of web file is shown here.

<html><records>
<record>
<slcalc>q=1.60217733e-19</slcalc>
</record>
<record>
<slcalc>sinh(x)=(exp(x)-exp(-x))/2</slcalc>
</record>
<record>
<KeyId>e</KeyId>
<KeyName>m</KeyName>
<KeyString>#$1=$2=0 while $1 lt $ ($2=$2+$[$1] $1=$1+1) $2/$#{mean}</KeyString>
</record>
</records></html>

In this example, the first record defines a constant q, the second record defines a function sinh(x), and the last record defines a 2nd key [m]. After uploading the above web file, enter the URL address in [22.URL address of file], and tap [21.load file].

When file is being loaded,  indicator appears. Sometimes, loading is failed since previous internet errors ramain. Please try a couple of times, if necessary.




9. Changing precision

Precision can be set between 13 and 256 in [37. precision]. Precision less than 13 is treated as 13, and precision greater than 256 is treated as 256.

Precision 13 : uses iPhone mathematical routines. Calculations are performed with 15 precision, and the calculation result is rounded to 13 precision. The range of number is between -1e308 and 1e308.

Precision 14 - 256: uses slcalc arbitrary precision mathematical routines. Calculations are performed with (precision+2), and the calculation result is rounded to (precision). The range of number is between -1e646456993 and 1e646456993.

10. Changing key layout

Key layout can be rearranged by [40. Settings of key layout].

Comments