6219 Reputation

17 Badges

7 years, 317 days

MaplePrimes Activity

These are replies submitted by mmcdara

@Carl Love 

Thank you Carl for your comments.

I'm often confused by the differences in behaviour between  fun~(...), map(fun, ...) and map(z -> fun(z), ...) which, in my mind, seem to be three different ways of doing the same thing, which they sometimes are,  but which are not always.

@Preben Alsholm 

I agree that the name of the integration variable doesn't matter and I wouldn't have been surprised if the simplification had replace both r1 and r2 by something like _t123.
So I agree that is not a "mathematical bug".

So let me put it another way by explaining the context in which these formulas appear.
A quite consensual notation (see PDF) for the probability density function of a random variable X is fX(x): please note the correspondence between the index of f and its argument.
For another random variable  Y this pdf will be written fY(y).

Next, one writes Int( x * fX(x), x=-oo..+oo) the expectation of X (same kind of notation for Y's).
So this kind of formula for the product of the expectations of X and Y.
        Int( x * fX(x), x=-oo..+oo) *  Int( y * fY(y), y=-oo..+oo),
Of course this is equal to
        Int( x * fX(x), x=-oo..+oo) *  Int( x * fY(x), x=-oo..+oo)
or even 
        Int( t * fX(t), t=-oo..+oo) *  Int( t * fY(t), t=-oo..+oo)
but the first notation "makes more sense" or is "more intuitive" than the second.

The formulas I used in my question came from the preliminary definition of two random variables named R[1] and R[1] whose respective pdf where noted varphi[1] and varphi[2] (random variables are indexed names to avoid introducing several different names ... thus the same indexing for the pdfs and for the integrations variables).
And for readaibility I  consider that preserving this correspondence between the names of the random variables and the integration variables is important.

Perhaps you'll understand better if I tell you that this is part of an interactive course on probability where the classic formulae are derived using Maple instead of being written on slides?
I feel that the teaching of probability is difficult enough not to introduce additional complexity due to potentially confusing notations, even if they are correct.

I guess I would have title my question "Could this be seen as simplify taking an unwelcome liberty?"

Thank you for your answer and for the time you spent reading mine.

Please provide an example of what you want to achieve.


Your example is biased for you know that the solution verifies y(2)=-1.
But what if you don't know?

@Carl Love 

How the hell did you come to infer that 

X := Array(1 .. num_profiles, 1 .. num_websites, rand(0..1))

must in fact be

X:= Matrix((num_profiles, num_websites), symbol= x):


I already told you in a previous question which has been deleted that this

X := Array(1 .. num_profiles, 1 .. num_websites, datatype = integer[0 .. 1])

wasn't valid  (here is the file I sent you then see the yellow highlighted text to create a (random) matrix fillef with 0 and 1, which I thought, but you never confirmed, you wanted then).

As you are probably a newby in Maple, my advice is to write only one command per block in order to see where the first error comes from and try to fix it before going further.
The error  associated to the command above is Error, n should be an integer for integer[n]

I agree it's not very explicit So change it a little bit to see what it becomes

X := Array(1 .. num_profiles, 1 .. num_websites, datatype = integer[0, 1])
Error, n should be 1, 2, 4, or 8 for integer[n]

Here it's more clear: you can only write integer[1], integer[2], ... and not integer[0, 1].

Fot instance

X := Array(1 .. num_profiles, 1 .. num_websites, datatype = integer[4])

builds an aray of zeroes.

Not what you want?
If you want instead an array of 0 and 1 do this

X := Array(1 .. num_profiles, 1 .. num_websites, rand(0..1))

Now look to your line

obj := minimize(max(seq(add(X[i, j], j = 1 .. num_websites), i = 1 .. num_profiles))); 

It contains 

add(X[i, j], j = 1 .. num_websites)

which is an integer (if the above definition of X suits you).
Then seq(..) is a sequence of integer and max(..) is an integer: what does it mean to minimize an integer?
Nothing, which this error would confirm

sol := Optimization[Minimize](obj, constraints, assume = binary)
Error, (in Optimization:-NLPSolve) problem must have at least one variable

Here again what does X is mean to be?

Simply provide a small sized X  build by hand to help us understand what X could be.


You're right about my first attachment: it's very limited and I wrote it more to give hints than to be something definitive.

By the way, it's strange that a Newton is defined as 1000*gram*meter/second^2 instead kilogram*meter/second^2.
Even forcing UseSystem('MKS') is no use to fix this.

It is all the more strange that grams, meters and seconds do not foem a standard unit system (MKS, or CGS).

Here is your original file after some corrections

dsolve now ends with

Error, (in dsolve/numeric/bvp) Newton iteration is not converging

As I'm not familiar enough with dsolve/numeic/BVP to fix this error I'm handing over to someone else.
For this I suggest you to replace your file by the attached one.

Good luck

Please use the big greeen up-arrow in the menu bar to upload your mw file.


While the Markov-like chain components of the code I wrote (procedures SingleChainMultipleChainsSplitChainand Slice) are almost independent of the ewpression of W, provided the number of "free" parameters is till equal to 2, the procedure Extrema, which is in fact is the core of the whole code, iw extremely dependent on the expression of W.

Si it's absolutely inevitable that a change in will make the code not to run correctly.

What is hidden in my post is the reason of the (phi_0, f)paramaterization of the admissible points instead of (beta, f).
The choice of this (phi_0, f)paramaterization comes from an analysis of ythe behaviour the behaviour of and of a lot of intermediate stuff. For your new W this phase has to be done again... or we must write something more generic that can handle virtually all functions.
While possible this will take a lot of time.

So I propose you to give a quick look to yout new W function and try to figure out what I can do  without spending days on it.
By the way:

  • Do you still want three extrema and a negative function (meaning the same pattern as your initil W)?
  • Do you already have a solution?


Start playing with the attached file to try and find solutions

To answer your problem, please provide boundary conditions for u[1](y), w[1](y), theta[1](y), C[1](y)


Answer is here

(Only case phi_0 < 0 as uou mentioned in your initial question)

@Carl Love 

I didn't see the things that way, this is indeed a possibility


For beta=0.19 and f=0.449 the value of phi_0 (the left most abscissa where the curve cut the horizontal axis) is equal to -2.241866411.

The condition w=0 at phi=phi_0 you mention in your initial question implies that if phi_0 = -2.241866411 then beta=0.19 and f=0.449.
There are no other couples (beta, f) such that the graph of the functions looks like the one you produce when  this left most abscissa is still equal to 

Nevertheless one can find as many triples  (phi_0, beta, f) such that the curve verifies your requirements (look more carefully my previous reply and look to the plot wich shows about a thousand of triples).

To be even more precise I corrected below your last reply:
Considering a function similar to W,  what I need is to know for which value of f and beta,  of phi_0, f and beta, the function  W has a behavior similar to the plot in my uploaded file (that is, 3 consecutive maxima under the horizonal axis while w and dw/dphi=0 at phi=0  (you missed the condition w=0 at phi_0, where phi_0 appears as a parameter just as beta and f) and these values can be extracted in the form of a T table (this is anecdotal) .

Here are 9 triples ontained with a given strategy:

Note the values of f and beta are close to those you give (resp 0.449 and 0.19).

Using another strategy one gets for instance

{beta = 2.036604998, f = 1.736212439, phi_0 = -2.493500878}, 
{beta = 1.977886064, f = 1.902189100, phi_0 = -2.417059357},
{beta = 2.092434996, f = 1.693623616, phi_0 = -2.535227509},
{beta = 2.029652994, f = 1.789715883, phi_0 = -2.487444549},
{beta = .3117789804, f = .3701884700, phi_0 = -2.589850012}

The values of f and beta are now very far from your "reference" values.

So, what kind of triples do you want to find:

  • Triples close to the reference values f=0.449 , beta=0.19?
  • Or triples possibly far from them?


The last line of your attached file says "# As it is seen for beta=0.19 and f=0.449 we have three consecutive local extrema. How can I find these critical values of (beta,f)?"

On the plot I see 4 extrema (from left to right: a minimum, a maximum, a minimum, a maximum), not 3.
More of this two extrema ar necessarily consecutive.
Do you want to find some (beta, f) values such that there exists only 3 extrema in some prior range A..B, or do you want something else?
Could you please detail your objectives and explain what phi_0 is?

Last thing I saw reading again your original question.

You wrote: "phi=0 and phi_0 where W=dW/dphi=0 at phi=0 and W=0 at phi_0 and W<0 for 0<abs(phi)<phi_0?"

  • W and dW/dphi are both aimed to be equal to 0 for some couple P°=(beta°, f°) of f and beta.
    Wich I'm going to write W(0, P°)=0, W'(0, P°)=0.
  • There exist another predefined value phi_0 of phi such that W(phi_0, P°)=0.
  • Assuming  phi_0 < 0, then W(phi, P°) < 0 whatever phi in phi_0..Phi .
    Or, assuming  phi_0 > 0, then W(phi, P°) < 0 whatever phi in ph..Phi_0.
  • Now:
    • Are you willing to give the value of phi_0 or is it an unknown/parameter of your problem?
    • Whatever the case, do you want to find a sibgle couple  or the relations f(phi_0) and beta(phi_0) must verify for W(0, f(phi_0), beta(phi_0)) verify the three requirements above?

Would you be interested in finding  the way to get, not a but several, triples T°= (phi_0°, f°, beta°) for which

  • W(0, T°)=0, W'(0, T°) = 0
  • W(phi_0=phi_0°, T°) = 0
  • W(phi, T°) < 0, for each phi in (phi_0°, 0)
  • W has only 3 extrema in the range (phi_0°, 0)

If this is your requirement, I can deliver you something to get them
Here is an illustration of what I got:


5 6 7 8 9 10 11 Last Page 7 of 126