3728 Reputation

17 Badges

6 years, 32 days

MaplePrimes Activity

These are answers submitted by mmcdara

And a third one :

1 +~ Statistics:-CumulativeSum(X)

You see here that MAPLE has many overlapping feature: look to Carl Love's answer.

BTW : I didn't know the procedure PartialSums of the ListTools package

@Rouben Rostamian  @acer  @Mariusz Iwaniuk 

Some of the solutions are based on some arbitrary cutoff and I do not consider they are correct.

Rouben's cutoff-free solution is far better ... if we accept a zero gravity of course !!!

You will find in the attached file another solution free of any trick  (excepted the instruction in pink used here to prevent null time ranges).
The solution is piecewise constructed (a strategy I use to use for more complex situations than the bouncing ball test case).

Make a zoom around the 16th rebound (t=4.2425543703...) for a detailed comparison between Rouben's solution and mine's


 1/ There is no deed to write f(x_i,y_i)=0.01 explicitely: just define a new function g(x_i, y_i) = f(x_i, y_i)-0.01
      The "constraint" the becomes g(x_i, y_i) = 0. This is not simpler: we just discard a useless numerical value.

2/ You say that f depends on some parameter, let's say p, you "calculated" by some optization process. 
     When does this process occur? Befor generatind the points, or after having generating them ?
Without more explanation I'm not sure anyone can give you the answer you are looking for?

Example   :  g(x, y, p) = x-y-p
                    Your "constraint" is g(x, y, p)=0.
                    A trivial solution is x_i = y_i for all i and p = 0
                    Another one is x_i = y_1 + 1 and p = -1

Please have a look to the attached file.
I do not find your second-order approximation but some mistake of my side is not exluded (it would have been safer for me to provide Maple code instead of Latex code).

First pointError, (in int) integration range or variable must be provided

if n=1 then return int(hd[i],t) fi:
return int(pn(i,n-1,t)):
end proc:

When n = 2 (your instruction  tmp := alpha1(t)*pn(i,1,t)+alpha2(t)*pn(i,2,t): ) the error message means there is no integration variable.
Changing int(pn(i,n-1,t)) by int(pn(i,n-1,t), t) eludes this message.

Second point: the execution of the line  A := Transpose(LinearSolve(Transpose(H+TMP), R))  takes a very huge amount of time (Maple 2017.2).
So I propose to rewrite the system in a more symbolic way (see the attached file   # let's try to solve the system in a more symbolic way)

Third point   Error, missing operator or `;`
Change "sum" into "add" after line #Now compute the approximate solution




Without presuming about what you really want to do ...

Your function is zero almost everywhere, which will be very difficult, if not impossible, to use it in an ODE/PDE problem.
Maybe a softened version of it could be sufficient ?
Without any pretention the attached file presents a simple idea to implement and use such a softened function.

From my experience (it is just my personal position and you will probably encounter people claiming the opposite): I never use the document-style worksheet as soon as the worksheet is relatively large, or until I do not need to have pretty inputs.
More generaly I'm not at all confident in the java interface ...

So my advice would be

  • go to the preferences
    • click on the "display" item
      • first item "input display" : select "Maple notation"
    • bottom : "apply to the session"
  • open a new worksheet in WORKSHEET-MODE style
  • copy into it "instruction by instruction" (to avoid loosing the Maple notation mode) the content of your document-style worksheet.

It should work correctly.

The attached file contains  the beginning of the "new" worsheet

This is an ad hoc way to proceed (the different situations "lambda__2 real" and "lambda__2 complex" are treated separately).
It can give you some ideas to go further but a Maple-Geek will certainly provide you a more astute solution.

Joel's answer is perfect.

In case you would prefer working with indexed elements   (for instance sm,n) instead of elements written like Smn, I can propose this to you

@Mariusz Iwaniuk 


You just need to form the difference between two infinite series.
(I used the Summtools package but maybe (?) "sum" could do the job as well)

About Mathematica: is it possible that it uses the same trick



assume(r > 0):

_EnvFormal := true;
Summation(k^(r), k=1..infinity)





S1 := Summation((a+d*k)^(r), k=1..infinity)

Zeta(0, -r, (d+a)/d)*d^r


assume(N > 1);

f := expand(a+d*(k-N));
f0 := coeff(f, k, 0);
f1 := coeff(f, k, 1);

S2 := Summation((A+B*k)^(r), k=1..infinity)







Zeta(0, -r, (A+B)/B)*B^r


subs({A=f0, B=f1}, S2)

Zeta(0, -r, (-N*d+a+d)/d)*d^r


S := S1 - subs({A=f0, B=f1}, S2)

Zeta(0, -r, (d+a)/d)*d^r-Zeta(0, -r, (-N*d+a+d)/d)*d^r





I understand your problem this way :

  • You have a function F in N parameters P1, ..., PN.
  • Each of them is modeled by a random variable
  • Then Z = F(P1, ..., PN) is a random variable too
  • Sensitivity Analysis (SA), in the statistical sense, assesses the variation of the "ouptut" Z given the variations random variations of the "inputs" P1, ...PN


There are two types of SA :

  • local : it is based on (generally first order by also second order can be used) partial derivatives of F arround at some point 
  • global : doesn't assume the "smallness" of the variations of the inputs the local SA requires
    (a recent question here is about Sobol indices, a key item in global SA)


It seems your are interested by local SA (LSA) ?

One ingredient is given here by Rouben if you use first order LSA.
But it's not sufficient. Let denotes by Vn the variance of Pn and by Dn the partial derivative of Z according to Pn
In LSA the sensitivity coefficient Sn of Z to Pn is defined by 
Sn = Vn*(Dn)^2 / sum(Vm*(Dm)^2, m=1..N).

Is it what you want ?

Best regards

At a first step, one might infer that searching for some rule behind your sequence, reduces to find some rule in the sequences of the exponents.
A good starting point is the OEIS data base, look

OEIS doesn't reference any of these 3 sequences

  • the sequence of the exponents of 3
  • the sequence of the exponents of 2
  • the sequence obtained by interleaving the two previous one

Unfortunately OEIS handles sequences of integer only, so you can't go further (even the smallest is to high a number to be used in OEIS).
So the OEIS option seems to be given up.

Maybe knowing where your sequence comes from could help ?

If you want to save the solution in some file, just type 

save pds, myfile    # I use to use ".m" file ; myfile is a string

To reuse the solution in a new worksheet :

read myfile:
anames(user) ; # will return you the the name(s) of the read objects it's not necessary but it can help if, like me, you're airhead



If you just want something for this particular case, here is a probably not very elegant solution

eq16 := r(t) = d__vol*V/(K*U*S*V^2+L*tau)

r(t) = d__vol*V/(K*S*U*V^2+L*tau)


a := rhs(eq16)



an := numer(a)/V;



ad := add(op(denom(a))/~V)



eq17 := lhs(eq16) = an / ad

r(t) = d__vol/(K*S*U*V+L*tau/V)






Maybe this could help ?



f := piecewise(-Pi <= x and x < 0, 1, 0 <= x and x < Pi, 0);
la := latex(f);

f := piecewise(`and`(-Pi <= x, x < 0), 1, `and`(0 <= x, x < Pi), 0)


\cases{1&$-\pi \leq x$\  and \ $x<0$\cr 0&$0\leq x$\  and \ $x<\pi $\cr}


lla := latex(f, output=string);

"\cases{1&$-\pi \leq x$\  and \ $x<0$\cr 0&$0\leq x$\  and \ $x<\pi $\cr}"


LA := StringTools:-SubstituteAll(la, "and", "\\vedge");

"\cases{1&$-\pi \leq x$\  \vedge \ $x<0$\cr 0&$0\leq x$\  \vedge \ $x<\pi $\cr}"


printf("%s\n", LA);

\cases{1&$-\pi \leq x$\  \vedge \ $x<0$\cr 0&$0\leq x$\  \vedge \ $x<\pi $\cr}









First 27 28 29 30 Page 29 of 30