Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@ALIKHADEMI To get a helpful answer, you need to tell exactly what it is that you have in mind. Based on the little information that you have provided, I can think of a dozen different useless answers because your question is unclear.

As it has been suggested before, it is best if you upload your maple worksheet (not a screen image) and explain what you want to do with it.

@ALIKHADEMI

The help you receive is generally proportional to the amount of information you provide.  If you state your problem more fully, you may receive a more detailed answer.

Note the big green arrow in the toolbar of the panel where you edit your message before posting. Clicking on that arrow will enable you to attach your Maple worksheet to your message.  Do that, and also explain what it is that you want to do with it because it may not be very obvious by just looking at the worksheet.

 

@ALIKHADEMI Perhaps this is what you want.  Let

f := x -> x^2;

Then to print the values of the function as x goes from 0 to 5 in steps of 1, do
seq(print(x,f(x)), x=0..5);
                                     0, 0

                                     1, 1

                                     2, 4

                                     3, 9

                                     4, 16

                                     5, 25

To print the values of f(x) as x goes from 0 to 1 in steps of 0.2, do
seq(print(x,f(x)), x=0..1, 0.2);
                                     0, 0

                                   0.2, 0.04

                                   0.4, 0.16

                                   0.6, 0.36

                                   0.8, 0.64

                                   1.0, 1.00

 

@ALIKHADEMI See if you can formulate your question clearly.  Give an example of the kind of thing you want to do.

@vv You are right in that we need some conditions on f for the integral to make sense, It is known that any f in L1(0,∞) will do. Moreover, the resulting solution u(x,t) is in C((0,∞)×(0,∞)) and satisfies the PDE in the classical sense in that open set.

@Hassan Alkomy Yes, you need to reformulate your system as you do in Matlab.

As for the explicit Euler method, as far as I know there is no Maple procedure because it's quite trivial.  A first order system looks like
dx/dt = f(t,x),  x(a)=b
where x is the vector of the unknowns.  We discretize time into intervals t[0]=a, t[1]=a+h, t[2]=a+2h, ..., and let x[0], x[1], x[2], ... be the corresponding approximate values of the solution x(t).  In the k-th interval we approximate the derivative dx/dt by the difference quotient (x[k+1] - x[k])/h, therefore the differential equation takes the form
(x[k+1] - x[k])/h = f(t[k], x[k])
that is
x[k+1] = x[k] + h*f(t[k], x[k]).

Thus, we may compute the solution at step k+1 based on the knowledge of the quantities at step k.  We start with the known quantities at step k=0, and march forward one step at a time.

If this is all new to you, you should begin with some simpler cases (with known solutions) which you can practice with.  Take, for example:
x' = x,
x(0)=1,
whose exact solution is x(t)=exp(t), and
x'' + x = 0,
x(0)=1, x'(0)=0,
whose exact solution is x(t)=cos(t).

 

I can't tell how familiar you are with numerical methods for solving ODEs, therefore the following may or may not make any sense to you.

If I were to investigate the source of the problem, I would

  1. Reformulate your system of five second order equations into a system of 10 first order equations;
  2. Apply a few steps of the explicit Euler method to the system with a small stepsize to see what the system wants to do.  If there is indeed a singularity, you will probably detect it here.

@vv That's very nice.  I had not expected such a simple and explicit inverse function for Fibonacci.

Thank you, kitonum, mmcdara, and vv for your comments.  As kitonum has observed, my suggested solution is obviously wrong.  The solutions offered by mmcdara and vv essentially agree and I trust that they are correct.  I cannot claim that I understand the logic behind their solutions right now, but I will think about them.

I misread the question and that led me to the following variant.

Let the sequence a1,a2,…,an be the outcome of n (n≥6) rolls of a die.  We say that the outcome is wonderful if there is a k so that ak=1, ak+1=2, …, ak+5=6.

Question 1: What is the probability of a wonderful outcome?

Question 2: What is n for which that probability is ≥1/2?

Edit:

If I am not mistaken, the answer to Question 1 is (n-5)/6^6, and therefore the answer to Question 2 is 23333.

Thank you very much, Kitonum and Acer, for your solutions.  These turned out to be much simpler than what I had expected—I had struggled quite a bit with the algebra without success before posting the question here.

 

@acer Thanks for your detailed comments.  I realize how plots:-display resolves/combines options from the various plot components, and in case of conflicting options it picks one.

That is the reasonable (and the only possible) behavior in general.  The light option, however, deserves to be treated as a special case since multiple light specifications need not be in conflict, but rather have additive effects.

This is not very difficult to do.  I have written graphing programs in OpenGL where multiple lights could be specified.  It may take a only a small tweaking of Maple's command parsing routines to permit multiple lights.

 

That works fine in Maple 2018.2.  I suggest that you upload your worksheet so that people can have a close look.

 

Acer and Carl, thanks so much for your comments.  It's the first time I am attempting Maple's Threads and Gird, and I did not know what to expect.

Following your suggestions, I switched from Threads:-Seq to Grid:-Seq and got my code working.  In my real application (not the skeleton one in the my question) I am getting a speedup by a factor or 3 on a quad-core CPU.  That's quite good.

@nepomukk As far as I know there is no simple way of doing that.

First 52 53 54 55 56 57 58 Last Page 54 of 99