<?xml version="1.0" encoding="UTF-8"?>
<Worksheet>
<Version major="12" minor="0"/>
<Label-Scheme value="2" prefix=""/>
<View-Properties presentation="true"></View-Properties>
<MapleNet-Properties elisiondigitsbefore="100" labelling="true" indentamount="4" elisiontermsthreshold="10000" ansi="false" errorbreak="1" useclientjvm="true" echo="1" imaginaryunit="I" labelwidth="20" plotdriver="openviz" elisiondigitsafter="100" plotoutput="terminal" rtablesize="10" elisiontermsbefore="100" elisiondigitsthreshold="10000" typesetting="standard" plotdevice="inline" verboseproc="1" showassumed="1" errorcursor="false" longdelim="true" plotoptions="" quiet="false" elisiontermsafter="100" screenwidth="79" preplot="" prettyprint="3" displayprecision="-1" warnlevel="3" screenheight="25" latexwidth="6.0" postplot="" prompt="&gt; " ShowLabels="true"/>
<Styles><Font name="Ordered List 1" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 2" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 3" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 4" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 5" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Author" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Warning" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input Placeholder" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[200,0,200]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="true"/>
<Font name="Maple Plot" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Code" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Line Printed Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Diagnostic" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[40,120,40]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Inert Output" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[144,144,144]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Normal" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,128,128]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Maple Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dash Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Math" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Input" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Header and Footer" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="10" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Error" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 1" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Bullet Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Equation Label" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 4" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 3" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="14" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 2" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="16" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dictionary Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[147,0,15]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="List Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Layout name="Maple Output" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.3" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 1" alignment="left" bullet="numeric" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Dash Item" alignment="left" bullet="dash" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 2" alignment="left" bullet="alphabetic" firstindent="0" leftmargin="36" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 3" alignment="left" bullet="roman" firstindent="0" leftmargin="72" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 4" alignment="left" bullet="ALPHABETIC" firstindent="0" leftmargin="108" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 5" alignment="left" bullet="ROMAN" firstindent="0" leftmargin="144" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Author" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="8" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Warning" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Annotation Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Maple Plot" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Error" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Line Printed Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 1" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="4" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Diagnostic" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Text Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="newline" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Bullet Item" alignment="left" bullet="dot" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 4" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Normal" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 3" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 2" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="2" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="List Item" alignment="left" bullet="indent" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Pencil-style name="Pencil 5" pen-color="[255,0,0]" pen-height="5.0" pen-width="5.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 4" pen-color="[0,0,255]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 3" pen-color="[0,0,0]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 2" pen-color="[0,0,255]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 1" pen-color="[0,0,0]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Highlighter-style name="Highlighter 2" pen-color="[255,204,0]" pen-height="14.0" pen-width="14.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 1" pen-color="[255,153,255]" pen-height="12.0" pen-width="8.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 4" pen-color="[0,255,255]" pen-height="32.0" pen-width="32.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 3" pen-color="[51,255,0]" pen-height="24.0" pen-width="24.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 5" pen-color="[255,255,0]" pen-height="48.0" pen-width="48.0" pen-opacity="0.8"/>
</Styles>
<Task-table>
    <Task-category name="&lt;default&gt;">
    </Task-category>
</Task-table>
<Task>
</Task><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L16" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal" alignment="centred"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L1" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal" alignment="centred"><Font bold="true" size="14">CALCULATE INTEGRALS BY MONTE-CARLO METHOD</Font></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L2" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L3" drawlabel="true">
<Input>
<Text-field style="Text" bold="true" layout="Normal" alignment="centred"><Font bold="true">Duong Ngoc Hao</Font></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L4" drawlabel="true">
<Input>
<Text-field style="Text" bold="true" layout="Normal" alignment="centred"><Font bold="true">University of Information Technology</Font></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L5" drawlabel="true">
<Input>
<Text-field style="Text" bold="true" layout="Normal" alignment="centred"><Font bold="true">Vietnam national university, Ho Chi Minh city- Vietnam.</Font></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L6" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L10" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">We build two procedures to determine integrals in one- dimenssion and two-dimenssion by Monte-Carlo method. These procedures are contained in </Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L12" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">packadge &quot;haodn_e.txt&quot; and suppose to be stored in drive D:</Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L14" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L7" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"> </Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L8" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"># Calculate integrals by Monte-Carlo method.</Text-field>
<Text-field style="Text" layout="Normal"># Written by Duong Ngoc Hao, University of Information Technology, Vietnam national university, Hochiminh city.</Text-field>
<Text-field style="Text" layout="Normal"># Truong dai hoc cong nghe thong tin, dai hoc quoc gia Tp HCM.</Text-field>
<Text-field style="Text" layout="Normal"># Updated 1 ngay 7.3.2009</Text-field>
<Text-field style="Text" layout="Normal"># Updated 2 ngay 22.3.2010</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"># Determine integral of the function f(x) by Monte-carlo method.</Text-field>
<Text-field style="Text" layout="Normal"># Syntax: intm1([f,x,a,b,c,d,n])</Text-field>
<Text-field style="Text" layout="Normal"># where f is an express of the function, x is a variable </Text-field>
<Text-field style="Text" layout="Normal"># n= number of random points</Text-field>
<Text-field style="Text" layout="Normal"># a,b means a&lt;= x &lt;=b</Text-field>
<Text-field style="Text" layout="Normal"># c,d means c&lt;= y=f(x) &lt;=d</Text-field>
<Text-field style="Text" layout="Normal"> </Text-field>
<Text-field style="Text" layout="Normal">haodn[intm1]:=proc(L::list(algebraic))</Text-field>
<Text-field style="Text" layout="Normal">	local m,n,i,j,B,H,a,b,c,d,rf,MM,LN,hits,estimate,Data;</Text-field>
<Text-field style="Text" layout="Normal">	n:=nops(L);</Text-field>
<Text-field style="Text" layout="Normal">	m:=5;</Text-field>
<Text-field style="Text" layout="Normal">	c:=L[n-3]-L[n-4];</Text-field>
<Text-field style="Text" layout="Normal">	d:=L[n-1]-L[n-2];</Text-field>
<Text-field style="Text" layout="Normal">	H:=unapply(L[1],L[2]);</Text-field>
<Text-field style="Text" layout="Normal">	MM:=1000*L[n];</Text-field>
<Text-field style="Text" layout="Normal">	for j from 1 to m do </Text-field>
<Text-field style="Text" layout="Normal">		rf:=rand(0..MM);</Text-field>
<Text-field style="Text" layout="Normal">		hits:=0;</Text-field>
<Text-field style="Text" layout="Normal">		for i to L[n] do </Text-field>
<Text-field style="Text" layout="Normal">			a:=evalf(L[n-4]+c*rf()/MM);</Text-field>
<Text-field style="Text" layout="Normal">			b:=evalf(L[n-2]+d*rf()/MM);</Text-field>
<Text-field style="Text" layout="Normal">			B:=evalf(H(a));</Text-field>
<Text-field style="Text" layout="Normal">			if b&lt;B then hits:=hits+1;</Text-field>
<Text-field style="Text" layout="Normal">			fi;</Text-field>
<Text-field style="Text" layout="Normal">		od;</Text-field>
<Text-field style="Text" layout="Normal">		estimate[j]:=evalf(c*d*hits/L[n]);</Text-field>
<Text-field style="Text" layout="Normal">	od;</Text-field>
<Text-field style="Text" layout="Normal">	Data:=[seq(estimate[j],j=1..m)];</Text-field>
<Text-field style="Text" layout="Normal">	estimate:=(1/m)*sum(Data[k],k=1..m);</Text-field>
<Text-field style="Text" layout="Normal">	end:</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal"># Determine double integral of the function f(x,y) by Monte-Carlo method</Text-field>
<Text-field style="Text" layout="Normal"># Syntax:  intm2([f,x,y,a1,a2,b1,b2,c1,c2,n])</Text-field>
<Text-field style="Text" layout="Normal"># where f is an express of the function; x,y are two independent variables.</Text-field>
<Text-field style="Text" layout="Normal"># n= so diem lay ngau nhien</Text-field>
<Text-field style="Text" layout="Normal">#[a1,a2] is closed interval of x</Text-field>
<Text-field style="Text" layout="Normal">#[b1,b2] is closed interval of y</Text-field>
<Text-field style="Text" layout="Normal">#[c1,c2] is closed interval of z=f(x,y)</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
<Text-field style="Text" layout="Normal">haodn[intm2]:=proc(L::list(algebraic))</Text-field>
<Text-field style="Text" layout="Normal">	local m,n,k,i,j,B,H,a,b,c,aa,bb,cc,g,rf,MM,LN,hits,estimate,Data;</Text-field>
<Text-field style="Text" layout="Normal">	n:=nops(L);</Text-field>
<Text-field style="Text" layout="Normal">	aa:=L[5]-L[6];    	#Do dai khoang tren Ox</Text-field>
<Text-field style="Text" layout="Normal">	bb:=L[n-3]-L[n-4];	#Do dai khoang tren Oy</Text-field>
<Text-field style="Text" layout="Normal">	cc:=L[n-1]-L[n-2];	#Do dai khoang tren Oz</Text-field>
<Text-field style="Text" layout="Normal">	H:=unapply(L[1],L[2],L[3]);</Text-field>
<Text-field style="Text" layout="Normal">	MM:=1000*L[n];</Text-field>
<Text-field style="Text" layout="Normal">	m:=5;</Text-field>
<Text-field style="Text" layout="Normal">	k:=L[n]^2;</Text-field>
<Text-field style="Text" layout="Normal">	rf:=rand(0..MM);</Text-field>
<Text-field style="Text" layout="Normal">	for j from 1 to m do </Text-field>
<Text-field style="Text" layout="Normal">		hits:=0;</Text-field>
<Text-field style="Text" layout="Normal">		for i to k do </Text-field>
<Text-field style="Text" layout="Normal">			a:=evalf(L[n-4]+aa*rf()/MM);</Text-field>
<Text-field style="Text" layout="Normal">			b:=evalf(L[n-2]+bb*rf()/MM);</Text-field>
<Text-field style="Text" layout="Normal">			g:=evalf(L[n-6]+cc*rf()/MM);</Text-field>
<Text-field style="Text" layout="Normal">			B:=evalf(H(a,b));</Text-field>
<Text-field style="Text" layout="Normal">			if g&lt;B then hits:=hits+1;</Text-field>
<Text-field style="Text" layout="Normal">			fi;</Text-field>
<Text-field style="Text" layout="Normal">		od;</Text-field>
<Text-field style="Text" layout="Normal">		estimate[j]:=evalf(aa*bb*cc*hits/k);</Text-field>
<Text-field style="Text" layout="Normal">	od;</Text-field>
<Text-field style="Text" layout="Normal">	Data:=[seq(estimate[j],j=1..m)];</Text-field>
<Text-field style="Text" layout="Normal">	estimate:=(1/m)*sum(Data[d],d=1..m);</Text-field>
<Text-field style="Text" layout="Normal">	end:</Text-field>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L17" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L18" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">Example:</Text-field>
</Input>
</Group>
<Group view="code" labelreference="L23" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">restart;
read `D:/haodn_e.txt`;
with(haodn);</Text-field>
</Input>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output">NyRJJmludG0xRzYiSSZpbnRtMkdGJA==</Equation></Text-field>
</Output>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L19" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L25" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">Suppose we want to determine <Equation executable="false" style="2D Math" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2JVEkaW50RicvJSdpdGFsaWNHUSV0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FsaWNHRjwvJStmb3JlZ3JvdW5kR1EsWzEyOCwwLDEyOF1GJy8lLHBsYWNlaG9sZGVyR0Y8L0YzUSdpdGFsaWNGJy1GIzYnLUZNNiRRIjFGJ0YyRlBGUkZVRlcvJTFzdXBlcnNjcmlwdHNoaWZ0R1EiMEYnLyUvc3Vic2NyaXB0c2hpZnRHRmpuLUYvNi1RIn5GJ0YyRjVGOC9GO0Y3Rj0vRkBGN0ZBRkNGRUZILUYvNi1RMCZEaWZmZXJlbnRpYWxEO0YnRjJGNUY4RmBvRj1GYW9GQUZDRkVGSC1JI21pR0YkNidRInhGJ0ZQRlJGVUZXRl1vRistRmZvNiVRI3h5RidGUEZXRl1vRmJvLUZmbzYlUSJ5RidGUEZXRjI=</Equation>, we we will use procedure <Font foreground="[255,0,0]">intm2 </Font><Font mathsize="12" mathvariant="normal" mathbackground="[255,255,255]" mathcolor="[0,0,0]" fontfamily="Times New Roman">as follow</Font></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L26" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"></Text-field>
</Input>
</Group>
<Group view="code" labelreference="L27" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">result:=intm2([x*y,x,y,0,1,0,1,0,1,1000]);</Text-field>
</Input>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2JVEncmVzdWx0RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEjOj1GJy9GM1Enbm9ybWFsRicvJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHRj0vJSlzdHJldGNoeUdGPS8lKnN5bW1ldHJpY0dGPS8lKGxhcmdlb3BHRj0vJS5tb3ZhYmxlbGltaXRzR0Y9LyUnYWNjZW50R0Y9LyUnbHNwYWNlR1EsMC4yNzc3Nzc4ZW1GJy8lJ3JzcGFjZUdGTC1JI21uR0YkNiRRLTAuMjUwMjM2NDAwMEYnRjkvJStmb3JlZ3JvdW5kR1EoWzAsMCwwXUYnLyUpcmVhZG9ubHlHRj1GOQ==">JCIrK1NPLUQhIzU=</Equation></Text-field>
</Output>
</Group>
<Group labelreference="L28" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"><Equation executable="true" style="2D Input" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2I1EhRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRic=">JSFH</Equation></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L21" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">It's is easy to determine the exact value of the integral above to compare with the approximated value, </Text-field>
</Input>
</Group>
<Group view="code" labelreference="L29" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">exact_value:=int(int(x*y,y=0..1),x=0..1);</Text-field>
</Input>
<Output>
<Text-field style="2D Output" layout="Maple Output"><Equation executable="false" style="2D Output" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2JVEsZXhhY3RfdmFsdWVGJy8lJ2l0YWxpY0dRJXRydWVGJy8lLG1hdGh2YXJpYW50R1EnaXRhbGljRictSSNtb0dGJDYtUSM6PUYnL0YzUSdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGPS8lKXN0cmV0Y2h5R0Y9LyUqc3ltbWV0cmljR0Y9LyUobGFyZ2VvcEdGPS8lLm1vdmFibGVsaW1pdHNHRj0vJSdhY2NlbnRHRj0vJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZMLUkmbWZyYWNHRiQ2KC1JI21uR0YkNiRRIjFGJ0Y5LUZTNiRRIjRGJ0Y5LyUubGluZXRoaWNrbmVzc0dRIjFGJy8lK2Rlbm9tYWxpZ25HUSdjZW50ZXJGJy8lKW51bWFsaWduR0Zobi8lKWJldmVsbGVkR0Y9LyUrZm9yZWdyb3VuZEdRKFswLDAsMF1GJy8lKXJlYWRvbmx5R0Y9Rjk=">IyIiIiIiJQ==</Equation></Text-field>
</Output>
</Group>
<Group labelreference="L31" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"><Equation executable="true" style="2D Input" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2I1EhRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRic=">JSFH</Equation></Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L32" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">By this way, we can easily compute more complicated integral like <Equation executable="false" style="2D Math" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYtLUkobXN1YnN1cEdGJDYnLUkjbW9HRiQ2LVEmJmludDtGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRicvJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHRjcvJSlzdHJldGNoeUdRJXRydWVGJy8lKnN5bW1ldHJpY0dGNy8lKGxhcmdlb3BHRjwvJS5tb3ZhYmxlbGltaXRz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xRlotRl1xNiVGZW8tRiM2JS1GZHE2JFEiNEYnRjJGTkZVRlpGMkYyLUYvNi1RIn5GJ0YyRjVGOEZbcEY9RlxwRkFGQ0ZFRkgtRi82LVEwJkRpZmZlcmVudGlhbEQ7RidGMkY1RjhGW3BGPUZccEZBRkNGRUZILUZLNidGZ29GTkZQRlNGVS1GSzYlUSNkeUYnRk5GVUYy</Equation>.</Text-field>
</Input>
</Group></Presentation-Block><Presentation-Block>
<Group view="presentation" hide-input="false" hide-output="true" inline-output="false" labelreference="L30" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal"><Equation executable="false" style="2D Math" input-equation="" display="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2I1EhRicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYn">JSFH</Equation></Text-field>
</Input>
</Group></Presentation-Block>
</Worksheet>