Details for 744_indexed-output.mw

Download file: 744_indexed-output.mw (View Live Worksheet on MapleNet)
Uploaded by lehalle(Maple Rating 2 183) (View other files uploaded by lehalle)

The HTML version of this file is shown below. To use the contents of this file in a posting, click here to get the source code


> retart;

Maple Equation

Functional object programming with Maple

Author: Charles-Albert LEHALLE, PhD

Simplest functional object

> simplest_fo:=proc(n) local this, set_;
this := [n];
set_:=proc( p); this[1]:=p; end proc;
table(['get'= (x->this[1]), 'set'= set_]);
end proc;

Maple Equation

> foo:=simplest_fo( 2);

Maple Equation

> foo['get']();

Maple Equation

> foo['set'](5);

Maple Equation

> foo['get']();

Maple Equation

Application to probability distributions

> G:=(m,s)->(t->(exp(-(t-m)^2/(2*s^2))/(sqrt(2*Pi)*s)));

Maple Equation

> structured_distribution:=proc( f, A, B)
table(['density'= (x->f(x)), 'repartition'=(x->Int(f(t),t=A..x)), 'plot'=(t->plot(f(x),x=A..B))]);
end proc:

> SD:=structured_distribution( G(0,1), -infinity, infinity):

> SD['density'](1);

Maple Equation

> SD['repartition'](1);

Maple Equation

> SD['plot']();

Maple Plot

>

>

>

This post was generated using the MaplePrimes File Manager

View 744_indexed-output.mw on MapleNet or Download 744_indexed-output.mw
View file details


HTML Source Code

Copy this code into any posting to insert this file into a posting on MaplePrimes

IMPORTANT INFORMATION

When pasting this code into a post on MaplePrimes, make sure that you choose the Worksheet HTML input format

Download Link Code

Copy this code into any posting to share this file with other users

}