MaplePrimes Questions

Hi, 

The CDF of a continuous random variable of support S is a bijective function f : S --> [0, 1].
So I expected that Maple would return only one solution when the command solve(f(t)=u, t) assuming u >=0, u <=1

When f(t) is the CDF of a Gamma random variable withparameters (2, 2), Maple returns two different solutions.

Could you explain me where the "spurious" solution (red curve) comes from?


 

restart

with(Statistics):

C := RandomVariable(GammaDistribution(2, 2))

_R

(1)

f := unapply(CDF(C, t), t) assuming t > 0;

plot(f(t), t=0..10);

proc (t) options operator, arrow; 1-(1/2)*t*exp(-(1/2)*t)-exp(-(1/2)*t) end proc

 

 

# f being a bijection from [0, +infinity) to [0, 1], its inverce does exist

s := solve({f(t)=u, t >=0}, t) assuming u >= 0, u <= 1;

{t = -2*LambertW((-1+u)*exp(-1))-2}, {t = -2*LambertW(-1, (-1+u)*exp(-1))-2}

(2)

pc := plot(CDF(C, t), t=0..10, color=blue):
T  := plottools:-transform((x, y) -> [y, x]):
plots:-display(T(pc), plot(rhs(op(s[1])), u=0..0.95, color=red), plot(rhs(op(s[2])), u=0..0.95, color=cyan, transparency=0.5, thickness=5));

 

 


 

Download ICDF_of_GammDistribution.mw

I have started to use Maple to test my calculations for a complex variable course.

The example is a complex integrand, and integration about an ellipse centered at origin.
Integrand has function 

f(z) = z*exp(a*z) / (z2+1)2

C:  z(t) = cos(t) + i*2*sin(t)

where a is a real constant. My idea is shown in the attatched workbook, i.e. 

dz = -sin(t) + i*2*cos(t) dt
g(t) = (-sin(t) + i*2*sin(t)) * f(cos(t) + i*sin(t))
int(g(t), t = 0..2*Pi)

PS, I've done similar code previously, but only for circle contours at center (see attachement)

The analytical answer is pi*a*sin(a), and Maple gives this correct for circular contours, but not for the ellipse.

So, what I'm asking is not how to solve the problem, but how to perform (arbitrary) contour integrals in Maple.

attachForMaplePrime.mw

I find the 2D math input in Maple to somewhat cumbersome for various expressions.
Specifically, I have a function f(z) = z^2, with w = f(I x + y) where I is the imaginary number.

I typed the line in 2D math

plots[implicitplot]({Im(w) = 2, Re(w) = 2}, x = -5 .. 5, y = -5 .. 5, colour = {"Blue", "Red"})
Error, (in plot/color) invalid color specification: {"Blue", "Red"}

For some reason this does not work in 2D math, but in Maple-input it works as expected.

I recall from past use of Maple, that there were other problems as well with the 2D math input.
I know you need to be particular with the use of space. 

Are there other common pitfalls or "bugs" related to use of 2D math input ?

Dear colleagues,

I need to determine a linear boundary of a data cloud. More specifically:

I have a set of experimental points y(x). On the plane x-y, the data points form a cloud of a triangular shape, with the legs coinciding with the x and y axes.  I need to best-fit the outer (upper-right), boundary of the data cloud, i.e. the hypotenuse of the "triangle",    with a linear function. It is not necessary for the line to go through the boundary points exactly, I need a best-fitting approximation (actually, the gradient of the line). Could someone give me any idea how to do it? (Or, at least, advice how I can google it, as my searches like "approximate boundary data cloud" return loads of irrelevant stuff.

Thanks in advance!

Hi,

 

So I'm new to MAPLE and working on plotting graphs for a car suspension system. I've had to differentiate some equations and use other formulas to calculate the peak of 7 different curves. I then need to plot these onto another graph. I've managed to calculate the values but I'm now trying to plot them on the graph using the pointplot command and I'm getting an error. The full code is shown below, any help is appreciated, thanks;

> Y(s):=100/s:
> X2(s):=(Y(s)*(1400*s+135000)*(c2*s+k2))/((49.8*s^2+(1400+c2)*s+135000+k2)*(466.5*s^2+c2*s+k2)-(c2*s+k2)^2):
> with(inttrans):
> x2(t):=unapply( expand( evalf( invlaplace(X2(s),s,t) )),t,c2,k2):

> c2_1:=simplify( x2(t)(t,1000,3000) ):
> D1:=diff( c2_1,t ):
> t_star1:=fsolve( D1,t=0.2..2 ):
> xp1:=x2(t)(t_star1,1000,3000):
> o1:=((xp1-100)/100)*100:

> c2_2:=simplify( x2(t)(t,1250,3000) ):
> D2:=diff( c2_2,t ):
> t_star2:=fsolve( D2,t=0.2..2 ):
> xp2:=x2(t)(t_star2,1250,3000):
> o2:=((xp2-100)/100)*100:

> c2_3:=simplify( x2(t)(t,1500,3000) ):
> D3:=diff( c2_3,t ):
> t_star3:=fsolve( D3,t=0.2..2 ):
> xp3:=x2(t)(t_star3,1500,3000):
> o3:=((xp3-100)/100)*100:

> c2_4:=simplify( x2(t)(t,1750,3000) ):
> D4:=diff( c2_4,t ):
> t_star4:=fsolve( D4,t=0.2..2 ):
> xp4:=x2(t)(t_star4,1750,3000):
> o4:=((xp4-100)/100)*100:

> c2_5:=simplify( x2(t)(t,2000,3000) ):
> D5:=diff( c2_5,t ):
> t_star5:=fsolve( D5,t=0.2..2 ):
> xp5:=x2(t)(t_star5,2000,3000):
> o5:=((xp5-100)/100)*100:

> c2_6:=simplify( x2(t)(t,3000,3000) ):
> D6:=diff( c2_6,t ):
> t_star6:=fsolve( D6,t=0.2..2 ):
> xp6:=x2(t)(t_star6,3000,3000):
> o6:=((xp6-100)/100)*100:

> c2_7:=simplify( x2(t)(t,4000,3000) ):
> D7:=diff( c2_7,t ):
> t_star7:=fsolve( D7,t=0.2..2 ):
> xp7:=x2(t)(t_star7,4000,3000):
> o7:=((xp7-100)/100)*100:

> with(plots):
> pointplot( {[1000,o1],[1250,o2],[1500,o3],[1750,o4],[2000,o5],[3000,o6],[4000,o7]} );
Error, (in pointplot) incorrect first argument
 

P.S. o1 through to o7 represent the peak of the curves and are to be plotted on the y-axis against 1000,1250,1500,1750,2000,3000 and 4000 on the x-axis. I'm using MAPLE V.

 

Thanks to the answers received by mapleprime friends, I have made 2 documents. In both documents, i want the expression to be modified and shown in mathcontainer. In my earlier question  "Slider Commands - "value" or value or both are ok" ,   the command " SetProperty (MathContainer0, value,sin(x)" it worked. In the attached doc, it does not work. The same command in updateplot procedure, works, but incorrectly.

Thanks for clarification.

Ramakrishnan V
 

restart

NULL

Function: Examples: "y = a+b*x+c*x^(2)+...; y = a^(x); y = a sin(bx+c)+d;  y = a f(bx+c) + d"

All valid input values for the function ( i.e. for x value, function exists) is domain. This can be visualized by a point in graph (x,y)

restart

 

               

 

 

               

    
                      

 

                

 

 

                 

 

                             

``

``a

a

(1)

b

b

(2)

c

c

(3)

d

d

(4)

NULL

 

 

           

NULL


 

Download doubt2_MathContainer.mw

In the attached document, I have made use of both commands as follows.

a:=GetProperty(SliderA,"value");

b:=GetProperty(SliderB,value);

Both are working alright. How is it possible? Which one is desirable?


 

a:

b:

For sliderA, GetProperty(SliderA,"value") is used.

For sliderB, GetProperty(SliderB,value) is used.

Both are working alright. How? Which one is more desirable?

``


 

Download Doubt_on_SliderCommand.mw

Thanks for answering.

Ramakrishnan V

This works fine, but I was wondering whether it could be done in a simple way.
 

``

restart; kernelopts(version); interface(version)

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

 

`Standard Worksheet Interface, Maple 2018.2, Windows 10, November 16 2018 Build ID 1362973`

(1)

kollect := proc (p::`+`, y) local x; subs(x = y, collect(subs(y = x, p), x)) end proc

kollect(kollect(kollect(kollect(expand(add(mul(k)*add(k), `in`(k, combinat:-choose([i1, i2, i3, i4], 3)))), i1^2), i2^2), i3^2), i4^2)

(i1*i2+i1*i3+i2*i3)*i4^2+(i1*i2+i1*i4+i2*i4)*i3^2+(i1*i3+i1*i4+i3*i4)*i2^2+(i2*i3+i2*i4+i3*i4)*i1^2

(2)

``


thanks in advance,

Harry

Download nested_comb.mw

Can anyone tell me what is the command to calculate maximum absolute error in mapple.

restart;
A002487 := proc (m) local a, b, n; option remember; a := 1; b := 0; n := m; while 0 < n do if type(n, odd) then b := a+b else a := a+b end if; n := floor((1/2)*n) end do; b end proc; listeinverse := proc (L::list) local i; [seq(op(nops(L)-i, L), i = 0 .. nops(L)-1)] end proc; Brocot := proc (n) local c, i, L, M, r; L := NULL; r := 2^n; L := [seq(A002487(i), i = 0 .. r)]; M := listeinverse(L); c[0] := 0, 1/cat(0); for i to r do c[i] := L[i]/M[i] end do; c[r+1] := 1/cat(0); return [seq(c[i], i = 1 .. r+1)], r+1 end proc; for i from 0 to 4 do B || i := Brocot(i) end do;
                              [   1]   
                        B0 := [0, -], 2
                              [   0]   
                             [      1]   
                       B1 := [0, 1, -], 3
                             [      0]   
                          [   1        1]   
                    B2 := [0, -, 1, 2, -], 5
                          [   2        0]   
                    [   1  1  2     3        1]   
              B3 := [0, -, -, -, 1, -, 2, 3, -], 9
                    [   3  2  3     2        0]   
       [   1  1  2  1  3  2  3     4  3  5     5        1]    
 B4 := [0, -, -, -, -, -, -, -, 1, -, -, -, 2, -, 3, 4, -], 17
       [   4  3  5  2  5  3  4     3  2  3     2        0]    
              rang := proc(M::list, a)  ...  end;;
                    /       1\ 
                rang|B2[1], -|;
                    \       2/ 
                / d        \        
                |--- don(x)| t work;
                \ dx       /        

F := proc (N) local a, b, L; L := NULL; L := sort([op({seq(seq(a/b, a = 0 .. b), b = 1 .. N)})]); return L, nops(L) end proc; F(1); F(2); F(3); F(4);
                           [0, 1], 2
                          [   1   ]   
                          [0, -, 1], 3
                          [   2   ]   
                       [   1  1  2   ]   
                       [0, -, -, -, 1], 5
                       [   3  2  3   ]   
                    [   1  1  1  2  3   ]   
                    [0, -, -, -, -, -, 1], 7
                    [   4  3  2  3  4   ]   
rang(F(3)[1], 2/3);
                        /[   1  1  2   ]  2\
                    rang|[0, -, -, -, 1], -|
                        \[   3  2  3   ]  3/

Hi everyone, I have some symbolic expressions as below:

restart;

local(Zeta);

Zeta := phi+(Ems+I*Eml)/(Ef-Ems-I*Eml)+(3*(1-phi))*((1-g)*alpha^2-(1/2)*g)/(alpha^2-1): 

g := (1/2)*Pi*alpha:

Lambda := (1-phi)*((3*(alpha^2+.25))*g-2*alpha^2)/(alpha^2-1): 

Ec := (Ems+I*Eml)/(1-(1/4)*phi*(1/Zeta+3/(Zeta+Lambda))):

a := simplify(Re(Ec)), assuming positive;

the output of the code maple gives me as 'a' is very long and boring! Therefore I want to make it shorter. Since (alpha<<1), I want to set a constraint as (alpha^(2 and more than 2)=0). How can I put that constraint on the output? thanks

sort(abs(z+a+b*i),z,descending) mean type z is sign + but print -z+5i-5

ran := rand(-5 .. 5); -1; a := ran(); -1; b := ran(); -1; sort(abs(b*i+a+z), z, descending)

abs(-z+5*i-5)

(1)

``


Can you help me?

Thank you very much.

Download abs.mw

help pls how to convert a data surface into a region:

surfdata([[1, 1, .69], [1, 2, .48], [2, 1, .37], [2, 2, .44]], axes = frame, labels = [x, y, z], filled = true)

I've tried to fill the volume below using the option "filled " without any results. I will appreciate any suggestion

Hello

After getting help from users on this list, I wrote an example on how to iterate a discrete map using a given initial condition as follows:

restart:with(ListTools):
NestList := proc (f, x, n::nonnegint, nprec::posint := 10) local R, k; R := rtable(0 .. n, [x]); Digits := nprec; for k to n do R[k] := expand(f(R[k-1])) end do; [seq(R)] end proc:
logistic := proc (x) options operator, arrow; 4*x*(1-x) end proc:
fp := [solve((logistic@@5)(x) = x, x)]:
cfp := allvalues(fp[5]);
nstep:=12:
p := nstep+50; 
aaa := Flatten(map(`~`[Re], evalf(NestList(logistic, evalf(cfp), p)))); 
dat := [seq([i-nstep-1, aaa[i]], i = 1 .. p)]; 
plot(dat, style = pointline, symbol = solidcircle, symbolsize = 4, thickness = 0, view = [default, 0 .. 1]);

The result should be a period 5 and some chaotic data due to machine precision. However the trajectory ejected to infinity. I have tried with a different initial condition, say 0.1, and it worked just fine. Even if the precision is increased, the trajectory (orbit) will eventually eject to infinity.  I couldn't spot what is wrong.

I am running Maple 2017 on linux and on a mac. 

Many thanks

Ed

 

Hello

 

I need help creating a proceadure that does the following:

 

It takes two lists of the same length N   (0<N<inf), one is the numerical pivote list P and the other is a symbolic target list S.

 

Lets say for the simple case of N=3 that we input:

 

P=[22.5,14.3,78.2]

S=[x[1],x[2],x[3]]

 

First the proceadure will sort the Pivote list P, which will result in a local variable Ps=[14.3,22.5,78.2]

 

Next it will generate the rearanged indices of S when it was transformed into Ps, meaning the sort indices rearangment from [1,2,3] in S into [2,1,3] in Ps. This will result in another local variable PSI=[2,1,3]

 

Finally, the proceadure will use PSI to rearange (sort by proxy) the target list P, which in this case will result in the folowing output of [x[2],x[1],x[3]], where x[i] can be either symbolic variable or numeric.

 

So what I need is to use numeric list P to sort a non numeric list S of the same size.

 

I'd appreciate any tips or usefule commands that I can use in this proceadure. 

 

Thanks

 

 

First 719 720 721 722 723 724 725 Last Page 721 of 2427