Application Center - Maplesoft

App Preview:

My Useful Functions

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

 

 

 

 

 

 

         Image 

 

An Introduction to Maple 

 

 

 

The following was implemented in Maple by Marcus Davidsson (2009)

davidsson_marcus@hotmail.com
 

 

 

 

 

 

 

 

 

Input text 

 

click on "Text" and start typing 

 

 

Input Math 

 

click on "Math" and start typing 

 

 

How to split the window in two 

 

click on "Insert" and  "Table" 

 

 

 

16 (1)
 

 

`+`(6, a) (2)
 

 

2323 (3)
 

 

 

232333 (4)
 

 

232323 (5)
 

 

32323 (6)
 

 

 

 

How to draw a figure 

 

click on "Insert" and "Canvas" 

 

 

Drawing-Canvas 

 

 

 

 

How to define a variable 

 

 

`+`(`*`(2, `*`(y))) (7)
 

 

`+`(`*`(2, `*`(y))) (8)
 

 

How to undefine a variable 

 

 

 

 

`+`(`*`(2, `*`(y)))
x (9)
 

 

 

Clear definitions 

 

 

 

 

x (10)
 

 

 

Subscript 

 

press SHIFT and  _ 

 

 

x[alpha] (11)
 

 

Superscript 

 

press SHIFT ^ 

 

 

`^`(x, alpha) (12)
 

 

 

Round to the Nearest Integer 

 

 

 

 

 

 

 

 

0
0
1
1 (13)
 

 

 

How to solve for two unknowns in two equations 

 

 

 

{w[B] = `+`(`-`(`*`(`/`(1, 2), `*`(w[A])))), w[C] = `+`(`-`(`*`(`/`(2, 3), `*`(w[A]))))} (14)
 

 

 

 

Launch Help 

 

 

 

 

 

 

From String " " to float and from float to String "" 

 

 

 

 

 

1
1 (15)
 

 

 

 

Number of occurrences in a list 

 

 

2 (16)
 

 


Where is the worksheet located ?
 

 

 

C:\Users\Marcus\Desktop\Ph.D 2008-03-01\! MAPLE\Economics (17)
 

 



Check Equality
 


 

 

true (18)
 


 

 

A random number between -1 and 1 

 

 

 

-.9 (19)
 

 


Procedures
 

 

 

 

 

proc () Hello end proc
Hello (20)
 

 

 

or as: 

 

 










 

 

 

 

 

Vector[row](%id = 80275048) (21)
 

 

or as: 

 

 










 

 

 

 

 

Vector[row](%id = 91464756) (22)
 

 

 

 

or constructing factorials as follows: 

 

 

 

 

 

24
24 (23)
 

 

 

 

 

How to print

 

 

 

 

 

 

 

 

 

1
2
3
4
5 (24)
 

 



How to print with Spacing

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
1
 
2
 
3
 
4
 
5 (25)
 

 

or as follows: 

 

 

 

 

 

 

 

[w, e, r, t]
 
[A, B, C, D] (26)
 

 

 

 

or as follows: 

 

 

 

`*`([w, e, r, t], `*`([A, B, C, D])) (27)
 

 

 

 

 

 


Check type


 

 

false (28)
 

 

 

false (29)
 

 

 

true (30)
 

 

 


Display Precision
 

 

 

[3.000, 5.00000, 8.00000] (31)
 

 

 

 

[3.000, 5.00000, 8.00000] (32)
 

 

 

 

 

Change Default TypeSet plus Default Size 

 

 

1. Open Format -> Styles, scrolled down to C 2D Input, selected it, clicked 'Modify' then modified as I'd like. Note that the leading `C' stands for `character'.2. Repeat with C 2D Output3. Open Format -> Manage Styles. Select the 'User Define Style Set' radio button.  Click the New Style Set button. Click 'Select All' then 'Ok'. A menu will open that allows you to save this file.  Doing this makes it the default style. After the save you are returned to the Manage Styles box. Click Ok.4. Exit Maple.  Restart.  It should come up with your new defaults. 

 

 

 

 

Output from previous row 

 

 

`+`(`*`(2, `*`(y))) (33)
 

 

`+`(`*`(2, `*`(y))) (34)
 

 

Output 2 rows back 

 

 

`+`(`*`(2, `*`(y))) (35)
 

 

`+`(`*`(2, `*`(a))) (36)
 

 

`+`(`*`(2, `*`(y))) (37)
 

 

Extract operander from expression 

 

 

 

 

x = `+`(`*`(2, `*`(x)), `*`(4, `*`(y))) (38)
 

 

`+`(`*`(4, `*`(y))) (39)
 

 

 

 

Substitute 

 

 

 

`+`(`*`(2, `*`(y))) (40)
 

 

 

4 (41)
 

 

 

for more algebraic substitutions we should use the command algsubs or the command applyrule  

 

 








 

 

 

 

 

 

 

`/`(`*`(`+`(a1, a2, `-`(1)), `*`(x)), `*`(`+`(a1, a2)))
`/`(`*`(x, `*`(`+`(p, `-`(1)))), `*`(p))
`/`(`*`(`+`(a1, a2, `-`(1)), `*`(x)), `*`(p))
`/`(`*`(x, `*`(`+`(p, `-`(1)))), `*`(p)) (42)
 

 

 

Hide output 

 

 

 

 

 

Permutations 

 

 

 

 

[[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]
Totalnumber = 6 (43)
 

 

 

Pascal Triangle Maple 

 





 

Plot_2d  
 

 

 

 

 

How to enter commands that are executed together 

 

 

 

 

`+`(`*`(2, `*`(a)), `*`(2, `*`(b)), `*`(2, `*`(c))) (44)
 

 

Note that after we have entered c: we press SHIFT ENTER to get a new row 

 

 

 

 

Define variables by using subscript notation 

 

 

x[a] (45)
 

 

x[b] (46)
 

Note that a and b are inputed by typing x_a and x_b 

 

 

 

Define a function 

 

 

proc (x) options operator, arrow; `+`(`*`(3, `*`(x))) end proc (47)
 

 

15 (48)
 

 

 

Sequence in a list [  ] 

 

 

 

 

[x(1), x(2), x(3), x(4), x(5)] (49)
 

 

 

Acess list elements 

 

 

[x(1), x(2), x(3), x(4), x(5)] (50)
 

 

x(4) (51)
 

 

 

 

How to Simulate One Column with Random Numbers 

 

 

Matrix(%id = 79228028) (52)
 

 

 

How to Simulate Many Columns with Random Numbers 

 

 










 

Matrix(%id = 77960864) (53)
 

 

 

 

How to simulate a random numbers and store in list 

 

 

 




 

[-.479341933636560024, .784173699733298979] (54)
 

 

 

 

 

 

Time derivative 

 

 

 

 

diff(x(t), t) (55)
 

or as 

 

 

diff(x(t), t) (56)
 

 

Note that we put the dot on top of x by pressing SHIFT, CTRL and " after the variable x 

 

 

 

Differentiate a variable 

 

 

 

 

diff(g(x), x) (57)
 

or as 

 

 

diff(g(x), x) (58)
 

 

Differentiate an expression 

 

 

 

 

2 (59)
 

 

 

Differentiate f(x(t)) with respect to x(t) 

 

 

 

 

(D(f))(x(t)) (60)
 

 

eval(diff(f(t1), t1), {t1 = x(t)}) (61)
 

 

Differentiate f ( x, y ) with respect to the first variable x 

 

 

 

 

(D[1](f))(x, y) (62)
 

 

diff(f(x, y), x) (63)
 

 

Differentiate f ( x, y ) with respect to the second variable y 

 

 

 

 

(D[2](f))(x, y) (64)
 

 

diff(f(x, y), y) (65)
 

 

Differentiate a function (chain rule) 

 

 

 

 

V(a(b), c(d)) (66)
 

 

`*`((D[1](V))(a(b), c(d)), `*`(diff(a(b), b))) (67)
 

 

Differentiate a function of a function (chain rule) 

 

 

 

 

V(a(b, c), d(e, f)) (68)
 

 

`*`((D[1](V))(a(b, c), d(e, f)), `*`(diff(a(b, c), c))) (69)
 

 

 

Differentiate a function of a function of a function (chain rule) 

 

 

 

 

V(a(b(c, d)), e(f(g, h))) (70)
 

 

`*`((D[1](V))(a(b(c, d)), e(f(g, h))), `*`((D(a))(b(c, d)), `*`(diff(b(c, d), d)))) (71)
 

 

`*`((D[1](V))(a(b(c, d)), e(f(g, h))), `*`(eval(diff(a(t1), t1), {t1 = b(c, d)}), `*`(diff(b(c, d), d)))) (72)
 

 

 

Add table elements
 

 

 

 

[5, 7, 9] (73)
 

or as 

 

 

[ (74)
 

 

 

 

Apply a procedure to each operand of an expression 

 

 

 

 

[A, A, A, A, A] (75)
 

 

[g(A), g(A), g(A), g(A), g(A)] (76)
 

 

Isolate an expression 

 

 

 

 

`+`(`*`(2, `*`(y)), `-`(`*`(A, `*`(B)))) = 0 (77)
 

 

`+`(`*`(2, `*`(y))) = `*`(A, `*`(B)) (78)
 

 

 

Solve for a variable 

 

 

 

 

`+`(`*`(3, `*`(z, `*`(D))), `-`(v)) = 0 (79)
 

 

`+`(`*`(3, `*`(z, `*`(D)))) (80)
 

 

or as 

 

 

`+`(`*`(3, `*`(z, `*`(D))), `-`(v)) = 0 (81)
 

 

{v = `+`(`*`(3, `*`(z, `*`(D))))} (82)
 

 

 

 

Combine Power Symbolic 

 

 

 

 

`*`(`^`(x, A), `*`(`^`(x, B))) = `^`(x, `+`(A, B)) (83)
 

 

 

`*`(`^`(A, x), `*`(`^`(B, x))) = `^`(`*`(A, `*`(B)), x) (84)
 

 

 

`^`(`^`(x, A), B) = `^`(x, `*`(A, `*`(B))) (85)
 

 

 

`^`(X, `+`(a, `-`(1))) (86)
 

 

 

 

 

 

Expand Power Symbolic ( The opposite of Combine) 

 

 

 

 

 

`^`(x, `+`(A, B)) = `*`(`^`(x, A), `*`(`^`(x, B))) (87)
 

 

 

`^`(`*`(A, `*`(B)), x) = `*`(`^`(A, x), `*`(`^`(B, x))) (88)
 

 

 

`/`(`*`(`^`(X, a)), `*`(X)) (89)
 

 

 

 

Simplify an expression 

 

 

 

 

 

`+`(A, `-`(`*`(A, `*`(`+`(1, `-`(B)))))) (90)
 

 

`*`(A, `*`(B)) (91)
 

 

 

 

a (92)
 

 

Note that e does not work 

 

 

`*`(a, `*`(ln(e))) (93)
 

 

 

 

 

 

 

Simplify an expression symbolicaly 

 

 

 

 

`*`(C, `*`(ln(B))) (94)
 

 

 

`+`(ln(A), ln(B)) (95)
 

 

 

`+`(ln(A), `-`(ln(B))) (96)
 

 

 

ln(`+`(A, B)) (97)
 

 

 

 

Collect terms 

 

 

 

 

`+`(`*`(z, `*`(A)), `*`(z, `*`(B)), z) (98)
 

 

`*`(`+`(A, B, 1), `*`(z)) (99)
 

 

 

Sort terms 

 

 

 

 

`+`(C, B, A) (100)
 

 

 

`^`(X, `+`(c, b, a)) (101)
 

 

 

 

 

Select Prime Numbers 

 

 

 

 

[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (102)
 

 

[11, 13, 17, 19] (103)
 

 

 

Remove Prime Numbers 

 

 

 

 

[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (104)
 

 

[10, 12, 14, 15, 16, 18, 20] (105)
 

 

Maximum in List 

 

 

 

 

[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (106)
 

 

20 (107)
 

 

Minimum in List 

 

 

 

 

[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] (108)
 

 

10 (109)
 

 

 

 

How to call a module (package) 

 

 

 

 

[2, 4, 6, 8] (110)
 

 

 

 

 

4 (111)
 

 

or as 

 

 

4 (112)
 

 

 

 

How to extract operandor from list 

 

 



 

 

 

 

 

[[1, 2], [3, 5], [2, 4], [3, 8], [4, 9]]
[1, 3, 2, 3, 4]
[2, 5, 4, 8, 9] (113)
 

 

 

 

 

How to make a drawing from a normaldistribution with mean zero and standard deviation equal to 1 

 

 

 

(114)
 

 

 

 

How to calculate the expected value 

 

 

[10, 20, 10, 5, 5] (115)
 

 

10. (116)
 

 

 

 

How to calculate the standard deviation 

 

 

[10, 20, 10, 5, 5] (117)
 

 

6.123724357 (118)
 

 

 

 

 

How to calculate returns 

 

 

 

[100, 120, 90, 80, 100, 110, 120, 130, 140, 150, 160, 150, 140, 130, 120, 140] (119)
 

 










 

(120)
 

 

 

How to Extract a PDF from a Set 

 

 

 

 

`+`(`/`(`*`(`/`(1, 2), `*`(`^`(2, `/`(1, 2)), `*`(exp(`+`(`-`(`/`(`*`(`/`(1, 2), `*`(`^`(`+`(ln(X), `-`(a)), 2))), `*`(`^`(b, 2))))))))), `*`(X, `*`(b, `*`(`^`(Pi, `/`(1, 2))))))) (121)
 

 

 

 

How to view the code for any Maple library routine 

 

 

 

 

 

The function blackscholes computes the present value of a call option 

 

 

blackscholes(amount, exercise, rate, nperiods, sdev , hedge)  

 

    amount   - current stock price     exercise - exercise price of the call option     rate     - risk-free interest rate per period, (continuously compounded)     nperiods - number of periods     sdev     - standard deviation per period of the continuous return on the stock     hedge    - (optional name) hedge ratio 

 

 

 

6.511554996 (122)
 

 

 

 

 

 

1
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
proc (Amount, Exercise, Rate, Nperiods, Sdev, Hedge) local d1, d2, Nd1, Nd2; option `Copyright (c) 1995 by Waterloo Maple Inc. All rights reserved.`; `assign`(d1, `/`(`*`(`+`(ln(`/`(`*`(Amount), `*`(E...
(123)
 

 

 

 

 

How to Calculate Probabilites from an Empirical Distribution-1 

 

 















 

 

 

Plot_2d
-2.335165534 (124)
 

   
 

 

 

 

Plot a Graph for Data and for a Function 

 

 


We can plot data as follows
 

 

 

Plot_2d  
 

 

 


or as follows
 

 

 

Plot_2d  
 

 

 

or as follows: 

 











 

Plot_2d  
 

 

 

 

We can plot a function as follows: 

 

 







 

Plot_2d  
 

 

or as 

 

 

Plot_2d  
 

 

 

 

 

 

How to plot a horizontal straight line 

 

 




 

Plot_2d  
 

 

 

 

 

How to plot a vertical straight lines 

 

 






 

Plot_2d  
 

 

 

 

 

Plot a graph given x and y-observations 

 

 

 

 

 

[2, 4, 6, 4, 2] (125)
 

 

[1, 2, 3, 4] (126)
 

 

 

Plot_2d  
 

 

 

 

How to plot multiple plots-1 

 

 








 

Plot_2d  
 

 

 

 

How to plot multiple plots-2












 

Plot_2d  
 

 

 

Dual Axis Plot 

 








 

Plot_2d  
 

 

 

 

 

 

How to plot side by side-1 

 

 






 

Plot_2d Plot_2d

 
 

 

 

 

 

 

 

How to plot side by side-2 

 

 








 

Plot_2d Plot_2d
Plot_2d Plot_2d

 
 

 

 

 

 

 

 

 

Horizontal Binomial Tree 

 

 













 

Plot_2d  
 

 

Vertical Binomial Tree 

 

 













 

Plot_2d  
 

 

 

 

 

 

Random Tree Structure 

 

 

Plot_2d  
 

 

 

 

 

Solve and plot recursive equations 

 

 

 

 

 

[100, 80.0, 64.00, 51.200, 40.9600, 32.76800, 26.214400, 20.9715200, 16.77721600, 13.42177280] (127)
 




 

Plot_2d  
 

 

 

 

Plot 3D Equations 

 

 



 

Plot_2d  
 

 


How to plot a Unit Root and 50 period Moving Average in Maple
 

 

 

























 

Plot_2d  
 

 

 

PointPlot with Labels 

 

 









 

Plot_2d  
 

 

 

 

 

 

Animations in Maple 

 

   
 

 

   
 











 

Plot_2d  
 

 











 

Plot_2d  
 

 

 











 

Plot_2d  
 

 

 















 

Plot_2d  
 

 

   
 

   
 

   
 

 

 

 

 

 

 

 

Lagrange in Maple 

 

 




















 

 

 

 

 

{c1 = `/`(`*`(Iota), `*`(p1, `*`(`+`(1., B, `*`(`^`(B, 2)), `*`(`^`(B, 3)))))), c2 = `/`(`*`(B, `*`(Iota)), `*`(`+`(1., B, `*`(`^`(B, 2)), `*`(`^`(B, 3))), `*`(p2))), c3 = `/`(`*`(`^`(B, 2), `*`(Iota)...
{c1 = `/`(`*`(Iota), `*`(p1, `*`(`+`(1., B, `*`(`^`(B, 2)), `*`(`^`(B, 3)))))), c2 = `/`(`*`(B, `*`(Iota)), `*`(`+`(1., B, `*`(`^`(B, 2)), `*`(`^`(B, 3))), `*`(p2))), c3 = `/`(`*`(`^`(B, 2), `*`(Iota)...
{c1 = 2.685826977, c2 = 1.705286970, c3 = 1.218062122, c4 = .9280473304, lambda = 0.3723248029e-1}
[1.61, [c1 = 2.69, c2 = 1.71, c3 = 1.22, c4 = .928]] (128)
 

 

 


Regression in Maple
 

 

 

























 

 

 

 

 

`*`(`^`(R, 2)) = .4929508997
Plot_2d  
 

 

 

 

 

 

we can also simulate some data and run a regression 

 

 


























 

`+`(`*`(.211887347517773744, `*`(x1)), `*`(.509920703987686852, `*`(x2))) (129)
 

 

 

 

 

 

Multiple Regression in Maple 

 

 













 

 

 

 

 

Matrix(%id = 73377956)
`+`(4.94029850746268639, `*`(1.95522388059701436, `*`(x[1])), `-`(`*`(1.13432835820895472, `*`(x[2])))) (130)
 

 

 

 

 

 

How to plot a system of differential equations 

 

 

























 

 

 

 

 

{diff(x(t), t) = `+`(x(t), `-`(`*`(2, `*`(y(t)))), 3), diff(y(t), t) = `+`(`-`(`*`(3, `*`(x(t)))), y(t), 3)}
{y = `+`(`-`(3), `*`(3, `*`(x))), y = `+`(`/`(3, 2), `*`(`/`(1, 2), `*`(x)))}
Plot_2d  
 

 

 

 

 

ChiSquare Test : Are two Samples drawn from the same distribution ?   

 

 










 

Chi-Square Test for Goodness-of-Fit
-----------------------------------
Null Hypothesis:
Observed sample does not differ from expected sample
Alt. Hypothesis:
Observed sample differs from expected sample

Categories:              6
Distribution:            ChiSquare(5)
Computed statistic:      5
Computed pvalue:         0.41588
Critical value:          11.07049741

Result: [Accepted]
There is no statistical evidence against the null hypothesis
 
 

 

 

 

 

 

Normality Test = Shapiro and Wilk's W-Test 

 

 
















 

Shapiro and Wilk's W-Test for Normality
---------------------------------------
Null Hypothesis:
Sample drawn from a population that follows a normal distribution
Alt. Hypothesis:
Sample drawn from population that does not follow a normal distribution

Sample size:             100
Computed statistic:      0.941602
Computed pvalue:         0.000364451

Result: [Rejected]
There exists statistical evidence against the null hypothesis
 
 

 

 

 

 

 

Remove duplicates in a list 

 

 

 

 

 

[a, a, b] (131)
 

 

[a, b] (132)
 

 

or as 

 

 

[a, b] (133)
 

 

 

 

 

How to make a comment in the code without problems 

 

 

 

 

a
a (134)
 

 

 

 

How to launce Debugger 

 

 

 

 

 

Insert DEBUG(): anywhere in the text to launce the debugger window 

 

 

 

How to count list elements 

 

 

 

 

[1, 2, 3, 4, 5] (135)
 

 

5 (136)
 

 

 

 

 

How to remove numerical range in a list 

 

 

 

 

[0, 1, 2, 3, 4, 5, 6, 0, 0, 0] (137)
 

 

 

 

[1, 2, 3, 4, 5, 6] (138)
 

 

[2, 3, 4, 5, 6] (139)
 

 

[1] (140)
 

 

 

 

 

 

How to sum/add list elements 

 

 

 

 

 

[1, 2, 3, 4] (141)
 

 

10 (142)
 

 

 

 

 

 

[1, 2, 3, 4] (143)
 

 

 

10 (144)
 

 

 

 

How to multiply list elements with each other 

 

 

 

 

[1, 2, 3, 4] (145)
 

 

24 (146)
 

 

 

How to multiply list elements with a variable 

 

 

 

 

[1, 2, 3, 4] (147)
 

 

4 (148)
 

 

w[1], `+`(`*`(2, `*`(w[2]))), `+`(`*`(3, `*`(w[3]))), `+`(`*`(4, `*`(w[4]))) (149)
 

 

 

Sum and multiply list elemets with a variable 

 

 

 

 

[1, 2, 3, 4] (150)
 

 

4 (151)
 

 

`+`(w[1], `*`(2, `*`(w[2])), `*`(3, `*`(w[3])), `*`(4, `*`(w[4]))) (152)
 

 

 

 

How to apply a procedure to each operand of an expression ( ie Logarithm transformation ) 

 

 

 

[1.6094, 2.3026, 2.9957, 3.6889] (153)
 

 

 

 

Integrals and Integration 

 

 

 

 

Int(`+`(`*`(`^`(x, 2)), `*`(2, `*`(x)), `/`(1, `*`(x))), x) (154)
 

 

`+`(`*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(`^`(x, 2)), ln(x)) (155)
 

 

`+`(`*`(.3333333333, `*`(`^`(x, 3))), `*`(`^`(x, 2)), ln(x)) (156)
 

 

We can have found this results by noting that 

 

 

 

 

 

[sum] (157)
 

 

 

CALCULUS1OBJECT([1, [], []], {x}) = `+`(Int(`*`(`^`(x, 2)), x), Int(`+`(`*`(2, `*`(x))), x), Int(`/`(1, `*`(x)), x)) (158)
 

 

 

[power] (159)
 

 

CALCULUS1OBJECT([1, [], []], {x}) = `+`(`*`(`/`(1, 3), `*`(`^`(x, 3))), Int(`+`(`*`(2, `*`(x))), x), Int(`/`(1, `*`(x)), x)) (160)
 

 

 

[constantmultiple] (161)
 

 

CALCULUS1OBJECT([1, [4], []], {x}) = `+`(`*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(2, `*`(Int(x, x))), Int(`/`(1, `*`(x)), x)) (162)
 

 

[power] (163)
 

 

CALCULUS1OBJECT([1, [], []], {x}) = `+`(`*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(`^`(x, 2)), Int(`/`(1, `*`(x)), x)) (164)
 

 

[power] (165)
 

 

CALCULUS1OBJECT([1, [], []], {x}) = `+`(`*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(`^`(x, 2)), ln(x)) (166)
 

 

  (167)
 

 

Which is the same result we had previously 

 

 

 

 

How to create a list 

 

 

 

 

[a, b, c] (168)
 

 

list (169)
 

 

 

How to create a set 

 

 

 

 

{a, b, c} (170)
 

Note that duplicates are removed in set 

 

 

set (171)
 

 

 

How to create a row vector 

 

 

 

 

(172)
 

 

Vector[row] (173)
 

 

or as 

 

 

 

(174)
 

 

 

Vector[row] (175)
 

 

 

How to create a column vector 

 

 

 

 

(176)
 

 

Vector[column] (177)
 

or as 

 

 

(178)
 

 

 

Vector[column] (179)
 

 

 

 

How a column vector into seperate column vectors 

 

 

 

 

(180)
 

 

(181)
 

 

(182)
 

 

 

 

How to sort one column vector descending and record a second column 

 

 

 

 

(183)
 

 

[[5, .9], [3, .99], [6, .8], [2, .85]] (184)
 

 

[[3, .99], [5, .9], [2, .85], [6, .8]] (185)
 

 

(186)
 

 

 

 

 

How to split a Row Vector into Two Rows 

 

 

 

(187)
 

 

 

(188)
 

 

 

(189)
 

 

 

 

 

How to create a matrix 

 

 

 

(190)
 

 

or as: 

 

 

(191)
 

 

 

Symmetrical Matrix 

 

 

 

(192)
 

 

(193)
 

 

 

 


How to view a large Matrix
 

 

 





 

Matrix(%id = 94538196) (194)
 

 

 

(195)
 

 

 

Double sum of a Matrix 

 

 

 

(196)
 

 

`+`(f[1, 1], f[1, 2], f[1, 3], f[1, 4], f[1, 5], f[2, 1], f[2, 2], f[2, 3], f[2, 4], f[2, 5], f[3, 1], f[3, 2], f[3, 3], f[3, 4], f[3, 5], f[4, 1], f[4, 2], f[4, 3], f[4, 4], f[4, 5], f[5, 1], f[5, 2]...
`+`(f[1, 1], f[1, 2], f[1, 3], f[1, 4], f[1, 5], f[2, 1], f[2, 2], f[2, 3], f[2, 4], f[2, 5], f[3, 1], f[3, 2], f[3, 3], f[3, 4], f[3, 5], f[4, 1], f[4, 2], f[4, 3], f[4, 4], f[4, 5], f[5, 1], f[5, 2]...
(197)
 

 

 

 

 

 

Double sum of a Covariance Matrix 

 

 

 

 

 

`*`(Portfolio, `*`(Variance)) = `+`(cov[1, 1], `*`(2, `*`(cov[1, 2])), `*`(2, `*`(cov[1, 3])), cov[2, 2], `*`(2, `*`(cov[2, 3])), cov[3, 3]) (198)
 

 

 

 

 

 

Double sum of a Covariance Matrix with Weights 

 

 








 

 

 

`*`(Portfolio, `*`(Variance)) = `+`(`*`(`^`(w[1], 2), `*`(cov[1, 1])), `*`(2, `*`(w[1], `*`(w[2], `*`(cov[1, 2])))), `*`(2, `*`(w[1], `*`(w[3], `*`(cov[1, 3])))), `*`(2, `*`(w[1], `*`(w[4], `*`(cov[1,...
`*`(Portfolio, `*`(Variance)) = `+`(`*`(`^`(w[1], 2), `*`(cov[1, 1])), `*`(2, `*`(w[1], `*`(w[2], `*`(cov[1, 2])))), `*`(2, `*`(w[1], `*`(w[3], `*`(cov[1, 3])))), `*`(2, `*`(w[1], `*`(w[4], `*`(cov[1,...
(199)
 

 

 

 

 

How to turn multiple sequences into a column matrix 

 

 

 

 

 

 

 

 

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77] (200)
 

 

 

Matrix(%id = 78088256) (201)
 

 

 

 

How to turn output from a loop into a Column Matrix 

 

 











 

Matrix(%id = 81958552) (202)
 

 

 

 

 

Matrix Dimensions: Number of Rows and Number of Columns 

 

 

 

 

 

Matrix(%id = 79271008)
50, 2 (203)
 

 

 

 

How Update a Variable with a Slider 

 

 

 

Embedded component 

 

 

Embedded component 

 

 

 

 

 

How Update a Correlation Matrix with a Slider 

 

 

 

Embedded component 

 

 

 

Embedded component 

 

 

 

 

How to get a random drawing with an button 

 

 

 

 

 

Button 

 

 

Embedded component 

 

 

 

 

How to simulate and plot a series of random numbers with an button 

 

 

 

 

 

 

 

 

Random    Reset 

 

Embedded component 

 

 

Embedded component 

 

 

 

 

 

How to simulate a unit root with an button-2 

 

 

 

 

 

 

 

 

Random     

 

 

 

Embedded component 

 

 

 

 

 

 

How Retrive a Value from a Slider 

 

 

 

 

Embedded component 

 

 

Embedded component 

 

 

 

 

.5 (204)
 

 

 

 

 

How to control multiple plots with an slider 

 

 














 

 

Embedded component 

 

 

 

Embedded componentEmbedded componentEmbedded component 

 

 

 

 

 

 

How to create a Column Matrix form a Lists 

 

 











 

 

 

 

 

 

 

Matrix(%id = 70801620)
201, 2
201
2 (205)
 

 

 

The difference between Matrix and Vector Index 

 

 

 

 

 

 

 

Matrix(%id = 82157672)
1
100 (206)
 

 

 









 

 

 

 

 

Matrix(%id = 82230568)
1
100, 1 (207)
 

 

 

How to create a matrix of vector rows 

 

 

 

 

(208)
 

 

Matrix (209)
 

 

 

 

How to create a matrix of vector columns 

 

 

 

 

(210)
 

 

Matrix (211)
 

 

 

 

How to delete a row in a matrix 

 

 

 

 

(212)
 

 

(213)
 

 

How to delete a column in a matrix 

 

 

 

 

(214)
 

 

(215)
 

 

 

How to add a row in a matrix 

 

 

 

 

(216)
 

 

(217)
 

 

(218)
 

How to add a column in a matrix 

 

 

 

 

(219)
 

 

(220)
 

 

 

 

(221)
 

 

 

 

How to add a specific columns to a matrix 

 

 

 

(222)
 

 

 

(223)
 

 

or as 

 

 

 

(224)
 

 

 

(225)
 

 

(226)
 

 

 

or as 

 







 

 

 

(227)
 

 

 

 

 

Columns of Columns 

 

 

 

 

 

(228)
 

 

(229)
 

 

(230)
 

Row of Row 

 

 

 

 

 

(231)
 

 

(232)
 

 

(233)
 

 

 

Test for equality 

 

 

 

 

 

(234)
 

 

(235)
 

 

true (236)
 

 

 

Vector addition 

 

 

 

 

 

(237)
 

 

(238)
 

 

(239)
 

 

 

Vector subtraction 

 

 

 

 

 

(240)
 

 

(241)
 

 

(242)
 

 

Scalar multiplication 

 

 

 

 

 

(243)
 

 

(244)
 

 

Matrix multiplication-1 

 

 

 

 

 

 

 

(245)
 

 

(246)
 

 

(247)
 

 

 

Matrix multiplication-2 

 

 

 

 

 

 

 

(248)
 

 

(249)
 

 

(250)
 

 

Matrix multiplication-3 

 

 

 

 

 

 

 

(251)
 

 

(252)
 

 

(253)
 

or as 

 

 

(254)
 

 

Matrix multiplication-4 

 

 

 

 

 

 

 

(255)
 

 

(256)
 

 

 

(257)
 

 

 

 

 

Conditional if-loop and for-loop 

 

 













 

 

 

 

 

Vector[row](%id = 78703768)
[B, B, A, B, A, B, B, B, B, B, B, A, A, A, A, B, B, A, A, B] (258)
 

 

 

 

Ordinary if-loop and for-loop 

 

 













 

 

 

 

 

Vector[row](%id = 79418104)
[B, A, B, A, B, B, B, A, B, B, A, B, B, A, B, B, A, A, A, B] (259)
 

 

 

 

 

If-loop and for-loop with Multiple If-commands 

 

 












 

[A, B, C, D, E, E, E, E, E, E] (260)
 

 

 

or as 

 

 

 









 

[A, A, A, A, A, B, B, B, B, B] (261)
 

 

 

 

or as 

 

 











 

 

 

1
1 (262)
 

 

 

 

 

 

Do-loop (repeats section for printing) 

 

 











 

 

 

 

 

 

 

`+`(A, `-`(.717533834536625226))
`+`(A, .394780603046090638)
`+`(A, `-`(0.819509190812375278e-1))
`+`(A, 1.28958713321658380) (263)
 

 

 

 

Do-loop (repeats section and store results in a list) 

 

 













 

[`+`(A, `-`(.356613504226274802)), `+`(A, `-`(2.08010888690061480)), `+`(A, .444870453778271446), `+`(A, `-`(.972735174115909485))]
[`+`(A, `-`(.356613504226274802)), `+`(A, `-`(2.08010888690061480)), `+`(A, .444870453778271446), `+`(A, `-`(.972735174115909485))]
(264)
 

 

 

 

can also be solved by using a procedure 

 

 














 

[`+`(A, .886998099789014450), `+`(A, `-`(.608195349253201956)), `+`(A, `-`(3.50030452229417666)), `+`(A, `-`(.688750250625201454))]
[`+`(A, .886998099789014450), `+`(A, `-`(.608195349253201956)), `+`(A, `-`(3.50030452229417666)), `+`(A, `-`(.688750250625201454))]
(265)
 

 

 

 

 

Double for-loop 

 

 










 

 

 

Matrix(%id = 90450860) (266)
 

 

 

 

 

How to loop though and test values from a list 

 

 

 













 

[90, 45, 27, 18, 63] (267)
 

 

 

 

 

For/Do Loops and Break Points 

 

 

 

 

2 (268)
 

 

 

another example 

 

 

 











 

60 (269)
 

 

 

another example 

 

 

 
















 

 

 

[1, 1, 1, 1, 1, 1, 1, 1, 1]
9 (270)
 

 

 

 

While Loops 

 

 














 

 

 

[1, 1, 1, 1, 1, 1, 1, 1, 1]
9 (271)