<?xml version="1.0" encoding="UTF-8"?>
<Worksheet>
<Version major="18" minor="1"/>
<Label-Scheme value="2" prefix=""/>
<View-Properties presentation="false" autoexpanding_sections="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" unitattributes="&quot;fontweight&quot; = &quot;bold&quot;" contextmenusize="automatic" plotdriver="opengl" elisiondigitsafter="100" plotoutput="terminal" helpbrowser="standard" rtablesize="10" elisiontermsbefore="100" elisiondigitsthreshold="10000" typesetting="standard" plotdevice="inline" verboseproc="1" showassumed="1" quiet="false" errorcursor="false" longdelim="true" plotoptions="" elisiontermsafter="100" screenwidth="79" preplot="" prettyprint="3" displayprecision="-1" screenpixelheight="1050" warnlevel="3" screenheight="25" latexwidth="8.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="Courier New" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Caption Reference" 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="Maple Input Placeholder" background="[255,255,255]" bold="true" executable="true" family="Courier New" 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="Courier New" 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="Courier New" 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="Courier New" 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="Courier New" 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="Times New Roman" 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="Courier New" foreground="[120,0,14]" 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="HyperlinkError" background="[255,255,255]" bold="false" executable="false" family="Courier New" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="true" 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="Courier New" 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="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="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="Heading 4" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="true" 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 3" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" 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="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="16" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="HyperlinkWarning" background="[255,255,255]" bold="false" executable="false" family="Courier New" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Dictionary Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[147,0,15]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Atomic Variable" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[175,0,175]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Caption Text" 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="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="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="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="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="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="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="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="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="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="HyperlinkError" 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="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="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="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="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="HyperlinkWarning" 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="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-table>
<Task/>
<Group labelreference="L1" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">restart; with(plots): with(LinearAlgebra):
#exampleNo := 1: # Beispiel 1 - Ornstein-Uhlenbeck
                # Beispiel 2 - Geometric Brownian
                # Beispiel 3 - Shiryaev</Text-field>
</Input>
</Group>
<Group labelreference="L2624" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">### !!!!! ###
### Die folgende Zeile bei erstmaligem Ausfuehren auskommentieren und auch nur dann! Ansonsten muss das Worksheet ggf. neu geoeffnet werden.
#currentdir(&quot;../../&quot;); 
### !!!!! ###
### In dem unterem Verzeichnis ggf. &quot;ex3-shiryaev&quot; in &quot;ex1-ou&quot; oder &quot;ex2-gb&quot; anpassen, je nach dem, welcher Prozess behandelt werden soll.
### Danach den darauffolgenden Ordner anpassen, je nach dem, welche numerische Simulation geplottet werden soll. 
currentdir(&quot;ut_N1_T005&quot;);
#currentdir();</Text-field>
</Input>
</Group>
<Group labelreference="L2088" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">readParams := proc()
  global exampleNo, xLeft, lengthX, mu_gamma, sigma, stateDim, controlDim, lambdaValue, alphaValue, mpcHorizon, mpcSteps, mpcStepsize, TT:
  local params:
  params := ImportVector(&quot;config.txt&quot;, skiplines=1):
  exampleNo := params[1]:
  xLeft := params[2]:
  lengthX := params[3]:
  mu_gamma := params[4]:
  sigma := params[5]:
  stateDim := convert(params[6],rational)+2:  # +2 Randpunkte.
  controlDim := convert(params[7],rational):
  lambdaValue := convert(convert(params[10],rational),float,1):
  alphaValue := convert(params[11],rational):
  mpcHorizon := convert(params[14],rational):
  mpcSteps := convert(params[15],rational):  
  mpcStepsize := convert(convert(params[16],rational),float,1):
  TT := mpcSteps * mpcStepsize: # Endzeit = MPC Sampling Rate * MPC Steps
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L1919" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">numericSol := proc() 
  local coords, values, numericPlot;
  coords := Vector([seq(xLeft + ii*lengthX/(stateDim - 1), ii=0..(stateDim - 1))]);
  values := ImportMatrix(&quot;trajectory.txt&quot;);
print(values);
if(exampleNo = 1) then
  numericPlot := display([pointplot(coords, Transpose(Row(values,1)), connect, legend=&quot;y_0&quot;, linestyle=&quot;dot&quot;, <Font encoding="UTF-8">title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=0.0), titlefont=[Times,Bold,12]</Font>), seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y&quot;, <Font encoding="UTF-8">title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize), </Font>titlefont=[Times,Bold,12]), i=2..mpcSteps+1)], insequence=true, color=blue);
elif(exampleNo = 2) then
  numericPlot := display([pointplot(coords, Transpose(Row(values,1)), connect, legend=&quot;y_0&quot;, linestyle=&quot;dot&quot;, title=typeset(&quot;<Font encoding="UTF-8">Geometric Brownian\134n</Font> %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=0.0), titlefont=[Times,Bold,12]), seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y&quot;, title=typeset(&quot;<Font encoding="UTF-8">Geometric Brownian\134n</Font> %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue,t=(i-1)*mpcStepsize), titlefont=[Times,Bold,12]), i=2..mpcSteps+1)], insequence=true, color=blue);
elif(exampleNo = 3) then
  numericPlot := display([pointplot(coords, Transpose(Row(values,1)), connect, legend=&quot;y_0&quot;, linestyle=&quot;dot&quot;, title=typeset(&quot;<Font encoding="UTF-8">Shiryaev\134n</Font> %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=0.0), titlefont=[Times,Bold,12]), seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y&quot;, title=typeset(&quot;<Font encoding="UTF-8">Shiryaev\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize), titlefont=[Times,Bold,12]), i=2..mpcSteps+1)], insequence=true, color=blue);
fi:
  return numericPlot;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L5556" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">adjointPlot := proc() 
  local coords, values, adjointplot;
  coords := Vector([seq(xLeft + ii*lengthX/(stateDim - 1), ii=0..(stateDim - 1))]);
  values := ImportMatrix(&quot;adjTrajectory.txt&quot;);
print(values);
if(exampleNo = 1) then
<Font encoding="UTF-8">  adjointplot := display([seq(pointplot(coords, Transpose(Row(values,i)), connect, labels=[x,p(x)], title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, </Font>t=(i-1)*mpcStepsize<Font encoding="UTF-8">), titlefont=[Times,Bold,12]), i=1..mpcSteps),plot(0, x=xLeft..xLeft+lengthX, labels=[x,p(x)], title=typeset(&quot;Ornstein-Uhlenbeck\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=green)], insequence=true, color=green);
elif(exampleNo = 2) then
<Font encoding="UTF-8">  adjointplot := display([seq(pointplot(coords, Transpose(Row(values,i)), connect, labels=[x,p(x)], title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize<Font encoding="UTF-8">), titlefont=[Times,Bold,12]), i=1..mpcSteps), plot(0, x=xLeft..xLeft+lengthX, labels=[x,p(x)], title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=green)], insequence=true, color=green);
elif(exampleNo = 3) then
<Font encoding="UTF-8">  adjointplot := display([seq(pointplot(coords, Transpose(Row(values,i)), connect, labels=[x,p(x)], title=typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize<Font encoding="UTF-8">), titlefont=[Times,Bold,12]), i=1..mpcSteps),plot(0, x=xLeft..xLeft+lengthX, labels=[x,p(x)], title=typeset(&quot;Shiryaev\134n %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=green)], insequence=true, color=green);
</Font>fi:
  return adjointplot;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L4122" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">controlPlot := proc()
  local controls, controlTimes, controlPoints, controlplot, coords;
if(controlDim = 1) then
  controls := Column(ImportMatrix(&quot;control.txt&quot;),1):
  controlTimes := Vector([seq(floor(ii/2)*mpcStepsize, ii=1..2*mpcSteps)]);
  controlPoints := Vector([seq(controls[ceil(ii/2)], ii=1..2*mpcSteps)]);
  print(controls);
  if(exampleNo = 1) then
<Font encoding="UTF-8">    controlplot := pointplot(controlTimes, controlPoints, connect, labels=[t,u(t)], title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]);
</Font>  elif(exampleNo = 2) then
<Font encoding="UTF-8">    controlplot := pointplot(controlTimes, controlPoints, connect, labels=[t,u(t)], title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]);
  elif(exampleNo = 3) then
<Font encoding="UTF-8">    controlplot := pointplot(controlTimes, controlPoints, connect, labels=[t,u(t)], title=typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]);
  fi;
elif(controlDim = stateDim-2) then
  coords := Vector([seq(xLeft + ii*lengthX/(stateDim - 1), ii=1..(stateDim - 2))]);
  controls := ImportMatrix(&quot;control.txt&quot;);
  if(ColumnDimension(controls) &gt; stateDim) then
    controls := controls[1..RowDimension(controls),1..ColumnDimension(controls)];
  fi:
  #print(coords);
  print(controls);
  if(exampleNo = 1) then
<Font encoding="UTF-8">    controlplot := display([seq(pointplot(coords, Transpose(Row(controls,i)), connect, labels=[x,u(x)], title=typeset(&quot;Ornstein-Uhlenbeck\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize,<Font encoding="UTF-8"> N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize), titlefont=[Times,Bold,12]), i=1..mpcSteps), plot(0, x=xLeft..xLeft+lengthX, labels=[x,u(x)], title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=black)], insequence=true, color=black, view=[xLeft..xLeft+lengthX,default]);
</Font>  elif(exampleNo = 2) then
<Font encoding="UTF-8">    controlplot := display([seq(pointplot(coords, Transpose(Row(controls,i)), connect, labels=[x,u(x)], title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize<Font encoding="UTF-8">), titlefont=[Times,Bold,12]), i=1..mpcSteps), plot(0, x=xLeft..xLeft+lengthX, labels=[x,u(x)], title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=black)], insequence=true, color=black, view=[xLeft..xLeft+lengthX,default]);
  elif(exampleNo = 3) then
<Font encoding="UTF-8">    controlplot := display([seq(pointplot(coords, Transpose(Row(controls,i)), connect, labels=[x,u(x)], title=typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=(i-1)*mpcStepsize<Font encoding="UTF-8">), titlefont=[Times,Bold,12]), i=1..mpcSteps), plot(0, x=xLeft..xLeft+lengthX, labels=[x,u(x)], title=typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4, %5&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue, t=TT), titlefont=[Times,Bold,12], color=black)], insequence=true, color=black, view=[xLeft..xLeft+lengthX,default]);
  fi;
fi;
  return controlplot;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L5594" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">targetFctPlot := proc()
  local coords, values, targetfctplot;
  coords := Vector([seq(xLeft + ii*lengthX/(stateDim - 1), ii=0..(stateDim - 1))]);
  values := ImportMatrix(&quot;desiredTrajectory.txt&quot;);
print(values);
if(exampleNo = 1) then
<Font encoding="UTF-8">  targetfctplot := display([plot(0, x=xLeft..xLeft+lengthX, title=typeset(&quot;Ornstein-Uhlenbeck\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize,<Font encoding="UTF-8"> N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red),seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y_d&quot;, title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red, linestyle=dash), i=1..mpcSteps)], insequence=true, color=red);
</Font>elif(exampleNo = 2) then
<Font encoding="UTF-8">  targetfctplot := display([plot(0, x=xLeft..xLeft+lengthX, title=typeset(&quot;Geometric Brownian\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize,<Font encoding="UTF-8"> N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red), seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y_d&quot;, title=typeset(&quot;Geometric Brownian\134n %1, %2, %3 </Font>%4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red, linestyle=dash), i=1..mpcSteps)], insequence=true, color=red);
elif(exampleNo = 3) then
<Font encoding="UTF-8">  targetfctplot := display([plot(0, x=xLeft..xLeft+lengthX, title=typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize,<Font encoding="UTF-8"> N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red), seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y_d&quot;, title=typeset(&quot;Shiryaev\134n %1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12], color=red, linestyle=dash), i=1..mpcSteps)], insequence=true, color=red);
</Font>fi:
  return targetfctplot;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L4978" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">numericSol3d := proc() 
  local coords, values, numericPlot;
  coords := Vector([seq(xLeft + ii*lengthX/(stateDim - 1), ii=0..(stateDim - 1))]);
  values := ImportMatrix(&quot;trajectory.txt&quot;);
print(values);
  numericPlot := display([seq(pointplot(coords, Transpose(Row(values,i)), connect, legend=&quot;y&quot;), i=1..mpcSteps+1)], insequence=true, color=blue);
  return numericPlot;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L2105" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">readParams();
#mpcSteps := 143:
totalCosts := ImportMatrix(&quot;totalcosts.txt&quot;, skiplines=1)[1,5];
exampleNo; xLeft; lengthX; mu_gamma; sigma; stateDim; controlDim; lambdaValue; alphaValue; mpcHorizon; mpcSteps; mpcStepsize; TT;
#targetFct1 := (x,t) -&gt; 1/(sqrt(2*Pi*0.2^2)) * exp(-(x-2*sin(Pi*t/5))^2 / (2*0.2^2));
#targetFct2 := (x,t) -&gt; 1/(x*sqrt(2*Pi*0.1^2)) * exp(-(log(x) - (1 + sin(Pi*t/5)))^2 / (2*0.1^2));
#if(exampleNo = 1) then 
<Font encoding="UTF-8">#  #bild1 := display([seq(plot(targetFct1(x,i * mpcStepsize), x=xLeft..xLeft+lengthX, view=[default,0..4], color=red, linestyle=&quot;dash&quot;, legend=&quot;y_d&quot;, #title=typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, costs = %3&quot;, N=mpcHorizon, lambda=lambdaValue, totalCosts), titlefont=[Times,Bold,12]), i=0..mpcSteps)], #insequence=true):
#  bild1 := display([seq(plot(targetFct1(x,i * mpcStepsize), x=xLeft..xLeft+lengthX, view=[default,0..2], color=red, linestyle=&quot;dash&quot;, legend=&quot;y_d&quot;, title=#typeset(&quot;Ornstein-Uhlenbeck\134n %1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]), i=0..mpcSteps)], insequence=#true):
</Font>#elif(exampleNo = 2) then
<Font encoding="UTF-8">#  bild1 := display([seq(plot(targetFct2(x,i * mpcStepsize), x=xLeft..xLeft+lengthX, view=[default,0..2], legend=&quot;y_d&quot;, color=red, linestyle=&quot;dash&quot;, title=#typeset(&quot;Geometric-Brownian\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]), i=0..mpcSteps)], insequence=#true):
#else
<Font encoding="UTF-8">#  bild1 := display([seq(plot(targetFct2(x,i * mpcStepsize), x=xLeft..xLeft+lengthX, view=[default,0..2], legend=&quot;y_d&quot;, color=red, linestyle=&quot;dash&quot;, title=#typeset(&quot;Shiryaev\134n </Font>%1, %2, %3, %4&quot;, T=mpcStepsize, N=mpcHorizon, lambda=lambdaValue, alpha=alphaValue), titlefont=[Times,Bold,12]), i=0..mpcSteps)], insequence=true):
#fi:
bild1 := targetFctPlot():
bild2 := numericSol():
display(bild2, insequence=true);
display(bild1, bild2);
controlPlot();
adjointPlot();</Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
</Input>
</Group>
<Group labelreference="L2241" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"></Text-field>
</Input>
</Group>
</Worksheet>