NSB Cosmic Center Image

N.S.B. Cosmic Center

NSB Cosmic Center Image

JavaScript & MathScript Interactive Document Generator-Demo-10

This document is generated by N.S.B. JavaScript & MathScript Interactive Document Generator version 001.

Introduction to N.S.B. JavaScript & MathScript Interactive Document Generator

MathScript Functions (cont.)

Before concluding our introduction to our JavaScript and MathScript Interactive Document Generator, and before shifting to more advanced aspects and applications of MathScript, we give a few more useful elementary functions.

The function isFree[] checks whether a MathScript function is free from some element (anywhere in its structure or substructures), that element being of a certain expression or property. For instance, consider the followings:

input(1)=> ff = F[a, b, 2.3, X[i, j, 11], x+y+z^2]
output(1)=> F[a, b, 2.300, X[i, j, 11], ((z^2)+x+y)]
input(2)=> isFree[ff, x] 
output(2)=> false
input(3)=> isFree[ff, X] 
output(3)=> false
input(4)=> isFree[ff, F] 
output(4)=> false
input(5)=> isFree[ff, j] 
output(5)=> false
input(6)=> isFree[ff, pow] 
output(6)=> false
input(7)=> isFree[ff, mult] 
output(7)=> true
input(8)=> isFree[ff, add] 
output(8)=> false
input(9)=> isFree[ff, c] 
output(9)=> true
input(10)=> isFree[ff, Y[i,j,11]] 
output(10)=> true
input(11)=> isFree[ff, X[i,j,11]] 
output(11)=> false

You should have noticed that we have checked whether our expression is free from mathematical expressions of addition, multiplication, and power (denoted by the function heads add, mult, and pow, respectively) and we found correct answers for that matter.

The functions unite[] and intersect[] are useful in combining the elements of two MathScript functions (having the same head expression) as if you are conctructing the union and the intersection of two sets respectively. Consider the followings:

input(12)=> ff={a, b, x, y, z}
output(12)=> {a, b, x, y, z}
input(13)=> gg={x, 2.3, b, 11.4, c} 
output(13)=> {x, 2.300, b, 11.40, c}
input(14)=> unite[ff, gg] 
output(14)=> {11.40, 2.300, a, b, c, x, y, z}
input(15)=> unite[gg, ff] 
output(15)=> {11.40, 2.300, a, b, c, x, y, z}
input(16)=> intersect[ff, gg] 
output(16)=> {b, x}
input(17)=> intersect[gg, ff] 
output(17)=> {x, b}

Now that you have followed these demodocs up to this point, and that you have used our client-side program to verify and experiment with code, either JavaScript or MathScript, then your preliminary knowledge is adequate to start on a forthcoming set of demodocs pertaining to advanced aspects and applications.

Program Page
NSB Cosmic Center Image

N.S.B. Cosmic Center

NSB Cosmic Center Image