SURVO MM Help System (web edition)

Functions defined in the edit field:
Functions of one or up to 10 variables may be defined by the user
by entering a definition of the form
   <function_name>(X1,X2,...):=function_of_X1,X2...
in the current edit field.
Examples: sinh(X):=(exp(X)-exp(-X))/2
          norm(X,Y):=sqrt(X*X+Y*Y)
          Fisher(r):=0.5*log((1+r)/(1-r))
       Roots of equation X^2+P*X+Q=0:
          Root1(P,Q):=-P/2+S(P,Q)   S(P,Q):=sqrt(P*P/4-Q)
          Root2(P,Q):=-P/2-S(P,Q)
       The Least Common Denominator: lcd(u,v):=u*v/gcd(u,v)
Any function defined in such a way may be used as any standard function.
Examples:
          sinh(1)=1.1752011936
          norm(12,norm(3,4))=13
          Root1(1,-6)=2   Root2(1,-6)=-3
          lcd(144,240)=720

Recursive functions:
By means of the if()then()else() structure recursive definitions for
functions may given as follows:
     factorial(N):=if(N=1)then(1)else(N*factorial(N-1))
  Serial expansion of the exponential function:
     expn(X,N):=if(N=0)then(1)else(expn(X,N-1)+term(X,N))
     term(X,N):=if(N=1)then(X)else(term(X,N-1)*X/N)
Examples:
          factorial(7)=5040
          expn(1,20)=2.7182818285
........................................................................
Since recursive computations take much space and time,
it is more efficient to use the 'for' statement for definitions
above:
     factorial(N):=for(I=1)to(N)product(I)
     expn(X,N):=for(I=0)to(N)sum(X^I/factorial(I))
Another way to speed up recursive computation is to employ a
`remember' option (see next page).
................................................................................

A recursive function can also be defined as follows:
     factorial(N)|=if(N=1)then(1)else(N*factorial(N-1))
See a '|' instead ':' in the definition! Then each numerical value
once obtained in recursion process is saved temporarily in a table
and instead of a recursion step a table-lookup is used in subsequent
evaluations. Computation of function values is then much faster.

Recursive computing requires much stack memory and may lead to
a stack overflow. The stack size given for the Survo Editor is
currently 10'000'000 bytes. The system parameter check_stack
(in SURVO.APU) determines the maximum size allowed in editorial
arithmetics. The default setting is check_stack=5000000 and it
can be changed temporarily by the SYSTEM command.

  E = More information on editorial computing 


More information on Survo from www.survo.fi
Copyright © Survo Systems 2001-2012.
webmaster'at'survo.fi