Category : Science and Education
Archive   : CC4.ZIP
Filename : DEMO4.CC

 
Output of file : DEMO4.CC contained in archive : CC4.ZIP
È
// Demonstration file for CC - Version 4
1

1
// This file demonstrates only those features
1
that are new to Version 4. You could run
2
the demo file for Version 3 to see the
3
original features of CC, but the 3D graphics
4
commands won't work. We demonstrate their
5
new syntax here.
6

1
// Matrices
1

1
A = {1,2,3;4,5,6;7,9,8} // 3 x 3 matrix
1

1
B = A" // Transpose of A
1

1
A + B // Sum
1

1
A*B // Product
1

1
A^(-1) // inverse of A
1

1
A/B // A*B^(-1)
1

1
A\B // A^(-1)*B
1

1
A = Random(3,5) // 3 x 5 matrix
1

1
B = RREF(A) // Row reduced form
1

1
C = B[1:3, 4:5] // submatrix
1

1
H = Matrix(1/(i+j-1),i = 1 to 4, j = 1 to 4)
1
// Hilbert Matrix
1

1
H^3 // third power
1

1
1/H // inverse of H
1

1
P = CharPoly(H) // Characteristic
1
polynomial
2

1
E = EigenVal(H) // Eigenvalues
1

1
Rank(H - E[1]*Eye(4)) // Should be 3, since
1
matrix - eigenvalue
2
is singular
3

1
// Big Numbers and Fractions
1

1
// A number preceded by & is called a Big
1
Number and will be maintained to infinite
2
precision. All computations with Big
3
Numbers and integers result in Big Numbers,
4
and quotients of Big Numbers are stored as
5
// exact fractions reduced to lowest terms.
1

1
x = &3/&5 // fraction
1

1
y = &7/4 - &2/3 // exact arithmetic
1

1
z = &3^100 // big numbers
1

1
w = &100! // very big numbers
1

1
H = Matrix(1/Fix(i+j-1),i = 1 to 4, j = 1 to 4)
1
// 4 x 4 Hilbert matrix. The function
1
FIX returns a Big Number. Its
2
complement is FLOAT
3

1
H*H // exact product
1

1
1/H // exact inverse of H
1

1
// New Three Dimensional Graphing Commands
1

1
// Version 3's 3d graphing commands have been
1
simplified, and new commands have been
2
added, in version 4.
3

1
Graph3d(x^2-y^2,x = -1 to 1, y = -1 to 1)
1
// no longer necessary to specify the third
1
limits or the number of steps
2

1
Paramg3d(sin(s)cos(t), sin(s)sin(t), cos(s),
1
s = 0 to pi, t = 0 to 2pi)
2
// x,y,z limits and the number of steps
1
need not be specified,
2

1
Curve3d(cos(t), sin(t), t, t= 0 to 4pi)
1
// new command for parametric curves
1

1
Matrixg(h)
1
// New command: Graph the data in a matrix
1

1
// New string operations
1

1
q1 = 'abc'|'de' // concatenation
1
q2 = q1[3] // single character
1
q3 = q1[2:4] // substring
1
q4 = upcase(q1) // upper case transform
1
n = pos('de',q1) // position of substring
1
m = asc(q1) // list of ascii codes
1
q5 = chr(m) // characters from codes
1
n1 = val('123 + cos(4)')
1
// value of a string
2
q6 = str(123+cos(4))
1
// string from a value
2

1
// See subroutine for new input@ command
1
intersect
1

1
È
// procedure demonstrating use of Input@
1

1
Procedure Intersect
1
// user finds intersection of two curves
1
Window(0,3,-1,1)
1
graphics
1
quickg(cos(x),x)
1
sk(x,x)
1
solve(cos(b)=b,b=1) // target for user to guess
1
Write@(.1,-.5,'Move crosshairs to intersection of curves, and')
1
Write@(.1,-.6,'enter x-coordinate where curves intersect')
1
Repeat
1
input@(.3,-.8,5,x)
1
ok = x > b-0.05 and x < b+0.05
1
if not ok
1
beep
1
end
1
until ok
1
write@(.1,-.7,x)
1
write@(.1,-.8,'You got it!!')
1
text
1
end // Intersect
1

1

1

1

1
input@(x,y)
1

1

1

1
È


  3 Responses to “Category : Science and Education
Archive   : CC4.ZIP
Filename : DEMO4.CC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/