MaplePrimes Questions


 

socau := proc (sc) local sccl, sccl2, sccl3, nhanbiet, n, td, ii, t, nhanbiet1, kk, bnb, thonghieu, n2, thonghieu2, bth, vandung, n3, vandung3, bvd, bang1; sccl := round((2/5)*sc); sccl2 := round((2/5)*sc); sccl3 := round((1/5)*sc); nhanbiet := [1, 2, 3, 4, 5]; n := nops(nhanbiet); td := rand(0. .. 1.00); for ii to n do t := trunc(n*td()+1); nhanbiet1[ii] := nhanbiet[t]; nhanbiet[t] := nhanbiet[n]; n := n-1 end do; for kk to sccl do bnb[kk] := nhanbiet1[kk] end do; print(nhanbiet1); print(bnb); thonghieu := [6, 7, 8, 9, 10, 11]; n2 := nops(thonghieu); td := rand(0. .. 1.00); for ii to n2 do t := trunc(n2*td()+1); thonghieu2[ii] := thonghieu[t]; thonghieu[t] := thonghieu[n2]; n2 := n2-1 end do; for kk to sccl2 do bth[kk] := thonghieu2[kk] end do; print(thonghieu2); print(bth) end proc:

socau(11)

bth

(1)

Parse:-ConvertTo1D, "invalid left hand side of multiple assignment"


with result bc :=[result bnb and bth]

Download help_table.mw

please help me

 

 

Hi all, my maple will crash when calculating this sheet.. Any help here?
 

``

``

restart

``

Digits := 15

15

(1)

NULL

NULL

``

c := .95

.95

(2)

``

theta := .9

.9

(3)

k := 1

1

(4)

p_l := 10^(-15)

1/1000000000000000``

(5)

n := 10^10

10000000000

(6)

``

fsolve(c = p_l^k*(1-p_l)^(n-k)*theta/(p_l^k*(1-p_l)^(n-k)*theta+p^k*(1-p)^n*(1-theta)), p = 10^(-6), 1.09*10^(-10) .. .1)

``

``

``

NULL

``

``

``

``

``

``

``

``

``

``

``

``


 

Download test.mw

Hello 

Sometimes It is cumbersome to put over script ,subscript  by using a mouse and get calculation error.

 

Is there any way to write over script or subscript by using some command as we do in Latex? 

 

Thank you

 

 

 

 

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

First 376 377 378 379 380 381 382 Last Page 378 of 2085