mmcdara

7891 Reputation

22 Badges

9 years, 50 days

MaplePrimes Activity


These are answers submitted by mmcdara

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).

qwerty.mw

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


pn:=proc(i,n,t)
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

example_1.mw
 

 

 

@raghav6594 

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.

sha.mw

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

EulerLagrange.mw

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.

root.mw

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

AX.mw

@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
 

restart:

with(SumTools):

assume(r > 0):

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

true

 

Zeta(-r)

(1)

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

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

(2)

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)

-N*d+d*k+a

 

-N*d+a

 

d

 

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

(3)

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

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

(4)

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

(5)

 


 

Download Serie.mwSerie.mw

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  https://oeis.org

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 :

restart:
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
 

NotAtAllGeneric.mw
 

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)

(1)

a := rhs(eq16)

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

(2)

an := numer(a)/V;

d__vol

(3)

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

K*S*U*V+L*tau/V

(4)

eq17 := lhs(eq16) = an / ad

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

(5)

 


 

Download NotAtAllGeneric.mw

 

Maybe this could help ?

 

Download latex.mw
 

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}"

(1)

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

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

(2)

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

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

 

 


 

Download latex.mw

 

 

 

 

Hi, 

 

Here is something unpretentious that could help you.

I think you will be able to improve this the way you want

parametric.mw

 

restart:
NewList := proc(L::list, treshold::{integer, float})::list:
   map(u -> if u < treshold then 2*u else u end if, L):
end proc:
a := [$(1..10)];
                [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b := 5:
NewList(a, b);
                [2, 4, 6, 8, 5, 6, 7, 8, 9, 10]


 

 

 

@Les 

Your problem relates to some of my own.
One of them is Bayesian Inference and directed acyclic grapgs (DAG) are a very important tool here.
I'm often worried by the difficulty do draw these DAG with Maple, that's why your problem triggered my interest.

I don't  know if this can help you, but I provide you this little Maple code, just in case


PermutationGraph.mw

First 62 63 64 65 Page 64 of 65