I have a degree in Mathematics and Physics from the Danish University Aarhus, comparable to a masters degree with thesis - majoring in Mathematics. In 1991-92 I was a visting scholar at UCLA, Los Angeles, following graduate courses in Applied Mathematics. Since 1992 I have been a teacher in a high school (gymnasium) in Denmark. Special interests: Applied mathematics, graphics and popularizing Mathematics.

MaplePrimes Activity

These are replies submitted by erik10

@tomleslie Yes one need to be careful about algebraic expressions involving those calls for random draws :)

Now that histograms for samples of the Random Variable connected to the Player/banker (call it X) is established, I was looking for a way to define or create the Random Variable X in Maple in the hope Maple could itself calculate the theoretical Mean and Variance (not for a sample). I looked at the commands Distribution and RandomVariable in the Statistics package. The few examples in the Help menu didn't help me much, though. Maybe it is not something one should do here?


@tomleslie Certainly I was aware of the reason why my command failed. Nice solution by defining the piecewise function first and then inserting Dice1() and Dice2() in order for the piecewise command to use the same draw in the entire command. 

Interesting what Carl Love tells below, by the way!



I prefer the histograms for my purpose, but the pointplot option is nice to know for other occasions. I like your improvement of the histogram by using the binbound option. The previous histograms had what seems like arbitrary binwidth and the bins were also placed somewhat arbitrarily. 

Next I am looking at a new Random Variable: The new Random Variable mimics the profit in one play from the viewpoint of a player playing against a banker. The player throws two dice. If one of the dice shows 1 dot, the player looses 4 dollars (therefore the value -4). On all other occasions the player wins the difference of the dots of the two dice, in dollars. All together this means the following possible values for the Random Variable: -4, 0, 1, 2, 3, 4.  

In my attached Maple document (sorry it is in Document Mode), I have made an attempt. Unfortunately the command 'piecewise' is not working here. The impossible value 5 has a nonzero frequency. It must be because the Dice1() and Dice2() are called twice (in the condition and later in the value calculated if the second condition is relevant), thereby applying different values. Maybe I need to assign the values of the two dice to two temporary variables and make an if ... do statement? Is there a convenient quick way? 

Now my samples are well done. It would be nice to have Maple calculate the correct frequencies. Obviously we have:



It would be extremely nice if Maple could somehow calculate it automatically from the definitions of the Random Variable involved. Maybe this need a setup like mmcdara?

Finally there is one request, which is not a must for me to be able to do, but would be real nice: Having Maple calculate and display results on the fly. I don't think it is possible in Maple, but I may be wrong. Some applets out there can show how the frequencies of a sample is approaching the real mean as time go. For educational purposes it would be great in order to show the "law of big numbers" in action!

Thanks for all your suggestions so far ...



Thanks to both of you. I like the techniques of mmcdara as well as the different plots of tomleslie. It is night here now. I will look more into it tomorrow. I will probably have a few more questions in the same department.

Good night for now,


@acer Thanks for your different alternative ways to make the interactive command. I am not sure which one I prefer at the moment.


@acer Thanks a lot for the thorough explanation and putting light on the issue mentioned. I now see that I can make the plot a lot better using numpoints with a bigger number. Also it seems like using the plot command in combination with the output=listprocedure is often a better choice than using odeplot. As I understand you also say that the accuracy when using fsolve(px(t)=60,t=0..50) is decent, but that the accuracy cannot be controlled completely. I assume the accuracy when using fsolve on equations involving ordinary functions is better than if fsolve is used on equations involving listprocedures like here?


Thanks to all of you! I see option output=listprocedure is very important. It makes it possible to define a function from the procedure. How is this handled inside Maple? I mean it can't just be a finite list of values. 

And a second question: Why does the solution to the equation px(t)=60 NOT match with the result of zooming in on the odeplot? See screenshot inserted into the attached file. I would expect a variation on the last few digits, but it happens already on the third!


Thanks for your contributions, tomleslie and mmcdara. I haven't had so much time to investigate things today.

tomlesIie, I will look into your way of handling the model solution in a matrix. Also thanks for the events option, which I didn't know beforehand. 

mmcdara, your way of handling the problem is very advanced and impressing, and you say you are not even finished :) I went through your code, and could understand part of it - in the time I had available today. I perfectly understand your idea of trying to find an estimate for the parameters alpha (the initial angle), v__0 (the initial velocity) and the Drag coefficient each contain an error. My original values were not the best. I had two few data points at the beginning of the throw to be able to give a value for alpha and v__0 with a high precision. Unfortunately only a minor deviation from the 'true' value vill result in quite large deviation in the throw-length, I am sure (so sensitive on the parameters). Therefore I think one need somehow to estimate these, and not take my original values for granted. Also probably the Drag Coefficient isn't as precise as desirable, although the weight of the ball is very precise as well as the diameter (the formula for the Drag Coefficient is in it's own a model ...). But wouldn't it be possible to use the experimental data to make the estimate, or is that cheating? I attach a zip-file containing four files: A new updated Maple file, in which I have imported the columns from the Excel file containing the experimental data, the Excel-file itself as well as two screenshots. One screenshot display a frame from the video, which will eventually give an idea about the precision. The other screenshot are the data-points plotted in a graph. 

NB! Remark that my new Maple file have slightly other values for the constants compared to my first Maple file. I wasn't able to find my original data-file for the first experiment, so I now use data from another one and adjusted the parameters. It should be no big deal though. The new constants can be substituted and the Maple file re-executed ...

So my question has now more shifted towards: what is the most proper way to evaluate or decide if model 2 is a good model for the experimental data? Although I feel very tempted to learn more about the Bayesian way myself (it is probably the best way) I hope there is a shorter way, because my students will never understand it. Would it be possible to use the command LSSolve from the Optimization package?

Thanks a lot for the contributions. This debate has turned into a very interesting one ...


Erik V.

@mmcdara Thank you for your reply. I will try your suggestion regarding output=Array[...] later today or tomorrow. 

What is maybe more interesting though is your considerations regarding a metric and "bayesian calibration of computer model". I am definitely interested in that. I know there is no canonical way of measuring how much experimental data is differing from model data, as you indicate. Also their is the issue about uncertainty on experimental data. It is a question how far I will go here. I have not decided to yet. In the actual situation a video of the throw has been filmed, and afterwards data have been collected automatically by manually pointing out the balls position by left-clicking frame by frame using data-logging software, roughly said. There is a number of uncertainties here: Has the middle of the ball been selected, has the camera been arranged on the tripod to shoot with vertical screen and alligned horisontally as well and more. The time is measured pretty well, I guess. One frame for every 1/30 second. 

There is another model to test for too: One in which the air-resistance is proportional to the absolute value of the velocity. Let's call this one for "Model 1" and the original one "Model 2". Model 1 has an analytical solution, whereas the original Model 2 only has a numeric solution. Anyway the perfect setup in Maple would be if I could somehow tell what model is the best! I assume it is Model 2, but would like to have that confirmed.

Erik V.


@acer Thanks! the insequence option made the trick. 


@acer Thanks for the tip about the workaround. It doesn't seem to work with the animation, though.


Hi again

I now understand how to retrieve the data for the numerical solution u(x,t) to the Wave Equation Boundary value problem mentioned above. Rouben told me how to get the value of the solution at a specific point (x,t). Of course I can extract the value using rhs ...

but let's say I wanted a table displaying the value of the solution for every x from 0 to 12 with step 0.5 and every t from 0 to 20 with step 1. What is the most convenient way to achieve this? Should I write a procedure with a for loop, create a matrix or ... ? I will appreciate it if someone could tell me how to do this in the most proper way with a decent output.




@tomleslie Thank you so much for your thorough explanation. It really helped clarify the comments in the help file. There seems to be a lot of possibilities here, indeed. What is lacking though is a way to scale the plot. The size option for ordinary plots doesn't work here ... so I need to do the scaling by dragging the plot, unfortunately 



@Kitonum I will go with the latter way, thanks! In the beginning I was confused about how the differential operator D works: D[1,2] means one time differentiation with respect to the first variable followed by one time differentiation with respect to the second variable, NOT one time differention with respect to the first variable and two times differentiation with respect to the second variable, as 2 could indicate. Not the most intuitive way, but now I understand ... 


@Carl Love Yes I copied your code including the space, then replaced the word "Slope" with the same word in Danish. It contains a non-english letter: æ. That was the issue. When using that letter, the space between the word and the number disappeared, when using the slider. If I replaced this special letter with say an e, then the space appeared again. I thought, that when using the backquotes, one could write whatever inbetween. I mean it is a caption only. Apparently this is not the case. If I wrote a colon in the text between the backquotes, and error even ocurred. 


1 2 3 4 5 6 7 Last Page 3 of 16