Maple Questions and Posts

These are Posts and Questions associated with the product, Maple


If n people (numbered 1 to n) stand in a circle and someone starts going around the circle and eliminating every other person till only one person is left, the number J(n) of the person left at the end is given by 

    J(n) = 1                           if n = 1
    J(n) = 2*J(n/2) - 1          if n > 1 and n is even
    J(n) = 2*J((n-1)/2) + 1   if  n > 1 and n is odd

(i) Write a recursive procedure to compute J. [As a check the first 16 values (starting with 1) of J(n) are 1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1]. 
(ii)Compute the value of J(10000). 
(iii) Can you explain why this is so much faster than our recursive procedure to compute the n-th Fibonacci number?

Has anyone installed and run maple under ubuntu installed the Windows Subsystem for Linux?   We are having trouble doing this: specifically running programs with text input files, etc.

 

 

I have a say sum(F(k) ,k=1..n)  It fails unless n is an actual integer.  But sum(F(k), k=1..a) works. Then then eval(%,a=n) completes it. That is probably correct but not necessarily a valid assumption. Details in attached. Also it is hard to understand the error message.
 

restart

``

``

Sinta := (k^2+n^2-k)*n/((k^2+n^2-2*k+1)*(k^2+n^2))

(k^2+n^2-k)*n/((k^2+n^2-2*k+1)*(k^2+n^2))

(1)

Ai := sum(Sinta, k = 1 .. n)

-((1/2)*I)*(2*n^2+I*n)*Psi(n-I*n)/(4*n^2+1)+((1/2)*I)*(2*n^2-I*n)*Psi(n+I*n)/(4*n^2+1)+((1/2)*I)*(-2*n^2+I*n)*Psi(n+1-I*n)/(4*n^2+1)-((1/2)*I)*(-2*n^2-I*n)*Psi(n+1+I*n)/(4*n^2+1)+((1/2)*I)*(2*n^2+I*n)*Psi(-I*n)/(4*n^2+1)-((1/2)*I)*(2*n^2-I*n)*Psi(I*n)/(4*n^2+1)-((1/2)*I)*(-2*n^2+I*n)*Psi(1-I*n)/(4*n^2+1)+((1/2)*I)*(-2*n^2-I*n)*Psi(1+I*n)/(4*n^2+1)

(2)

Souta := n/(k^2+n^2-k)

n/(k^2+n^2-k)

(3)

NULL

sum(Souta, k = 1 .. n)

Error, (in assuming) when calling 'Dfnt_4'. Received: 'when calling 'Dfnt_4'. Received: 'when calling 'unknown'. Received: 'invalid input: Dfnt_4 expects its 3rd argument, fpts, to be of type Or(list, piecewise), but received 0'''

 

"(->)"

Error, invalid input: evalf[10] expects 1 argument, but received 0

 

 

 

This works

sum(Souta, k = 1 .. a)

n*Psi(a+1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(a+1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)+n*Psi(1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)

(4)

Ao := eval(%, a = n)

n*Psi(n+1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(n+1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)-n*Psi(1/2-(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)+n*Psi(1/2+(1/2)*(-4*n^2+1)^(1/2))/(-4*n^2+1)^(1/2)

(5)

"(->)"

n*Psi(n+.5000000000-.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)-1.*n*Psi(n+.5000000000+.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)-1.*n*Psi(.5000000000-.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)+n*Psi(.5000000000+.5000000000*(-4.*n^2+1.)^(1/2))/(-4.*n^2+1.)^(1/2)

(6)

````

``


 

Download Summation_problem.mw

Dear Users!

Hope you would be fine. I want to construct system of equations by comparing the likes powers of x^i*y^j*t^k1*exp(k2*eta) for an expression H1 present in attached file. Please see the fix my problem. I shall be very thankful for your kind help. 

Help.mw

From  time to tiime Malel emits a sort of "Boiing" noise when I make a keyboard error. I am not sure exaclty when it does this, but it is loud. Is it possible to turn it off? I have looked quite extensively and cannot find out anything.

In the following problem at two example are given. For Z=2 the sum is converging whereas at Z=4 it is not converging. Thank you

 

PROBLEM.mw

I have a problem writing a program for the numerical solution of nonlinear volterra integral equation using the method of reproducing kernel space. I have my algorithm as well as the program I tried to write, though they are full of error messages. Please could anyone give me a clue on how to go about my challenges. The algorithm is as follows:

Step 1. Fix 𝑎 ≤ 𝑥 and 𝑡 ≤ 𝑏.
If 𝑡 ≤ 𝑥, set 𝑅𝑥(𝑡) = 1 − 𝑎 + 𝑡.
Else set 𝑅𝑥(𝑡) = 1 − 𝑎 + 𝑥.
Step 2. For 𝑖 = 1, 2, . . . , 𝑚 set 𝑥i = (𝑖 − 1)/(𝑚 − 1).

Set 𝜓i(𝑥) = 𝐿t𝑅𝑥(𝑡)|𝑡=𝑥i .
Step 3. Set 𝑢0(𝑥1) = 𝑢(𝑥1).
Step 4. For 𝑖 = 1, 2, . . . , 𝑚 set 𝛾ij = [𝜓-1]ij.
Step 5. 𝑛 = 1.
Step 6. Set Sn = Σ𝑛
𝑘=1 𝛾nk𝑢k-1(𝑥k).
Step 7. Set 𝑢n(𝑥) = Σ𝑛
𝑖=1 Si𝜓i(𝑥).
Step 8. If 𝑛 < 𝑚then set 𝑛 = 𝑛 + 1 and go to step 6.
Else stop.

So I have this system of equations with which I am not sure if the result is the same or not using "series" and "limit" or what is going on here.

I hope it is clear what I mean.


 

restart; with(MathematicalFunctions); Assume(k__2H2O > 0, `k__HA+OH` > 0, `k__A+H2O` > 0, `k__H3O+OH` > 0, `k__HA+H2O` > 0, `k__H3O+A` > 0, HA__0 > 0, H2O > 0); sys := k__2H2O*H2O^2+`k__A+H2O`*H2O*(HA__0-HA)-(H3O*`k__H3O+OH`+HA*`k__HA+OH`)*OH = 0, k__2H2O*H2O^2+`k__HA+H2O`*H2O*HA-(`k__H3O+A`*(HA__0-HA)+`k__H3O+OH`*OH)*H3O = 0, (H2O*`k__HA+H2O`+OH*`k__HA+OH`)*HA-(H2O*`k__A+H2O`+H3O*`k__H3O+A`)*(HA__0-HA) = 0; sys := `~`[simplify]([eval(eval(sys, HA = HA__0+OH-H3O), HA__0 = x__HA0*H2O)]); sol := solve(sys, [OH, H3O]); sol := sol[1]; OH__sol := simplify(rhs(sol[1])); H3O__sol := simplify(rhs(sol[2])); simplify(OH__sol*H3O__sol); OHH3O := simplify(limit(%, `k__HA+OH` = 0)); series(OHH3O, x__HA0 = 0, 2); collect(convert(%, polynom), x__HA0, simplify, factor); r1 := limit(%, x__HA0 = 0); r2 := radnormal(limit(OHH3O, x__HA0 = 0)); simplify(r1-r2)

[`&Intersect`, `&Minus`, `&Union`, Assume, Coulditbe, Evalf, Get, Is, SearchFunction, Sequences, Series]

 

{H2O::(RealRange(Open(0), infinity))}, {HA__0::(RealRange(Open(0), infinity))}, {k__2H2O::(RealRange(Open(0), infinity))}, {`k__A+H2O`::(RealRange(Open(0), infinity))}, {`k__H3O+A`::(RealRange(Open(0), infinity))}, {`k__H3O+OH`::(RealRange(Open(0), infinity))}, {`k__HA+H2O`::(RealRange(Open(0), infinity))}, {`k__HA+OH`::(RealRange(Open(0), infinity))}

 

k__2H2O*H2O^2+`k__A+H2O`*H2O*(HA__0-HA)-(H3O*`k__H3O+OH`+HA*`k__HA+OH`)*OH = 0, k__2H2O*H2O^2+`k__HA+H2O`*H2O*HA-(`k__H3O+A`*(HA__0-HA)+`k__H3O+OH`*OH)*H3O = 0, (H2O*`k__HA+H2O`+OH*`k__HA+OH`)*HA-(H2O*`k__A+H2O`+H3O*`k__H3O+A`)*(HA__0-HA) = 0

 

[-OH^2*`k__HA+OH`+((-x__HA0*`k__HA+OH`-`k__A+H2O`)*H2O+H3O*(`k__HA+OH`-`k__H3O+OH`))*OH+k__2H2O*H2O^2+`k__A+H2O`*H2O*H3O = 0, (x__HA0*`k__HA+H2O`+k__2H2O)*H2O^2+`k__HA+H2O`*(OH-H3O)*H2O+(-`k__H3O+A`*H3O+OH*(`k__H3O+A`-`k__H3O+OH`))*H3O = 0, H2O^2*x__HA0*`k__HA+H2O`+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`*`k__HA+H2O`)*H2O^2*(`k__A+H2O`+`k__HA+H2O`)/(`k__H3O+A`*(`k__A+H2O`*`k__H3O+A`-`k__A+H2O`*`k__H3O+OH`-`k__H3O+OH`*`k__HA+H2O`))

 

k__2H2O*H2O^2/`k__H3O+OH`

 

-`k__A+H2O`*(-(`k__A+H2O`+`k__HA+H2O`)^2*`k__H3O+OH`+k__2H2O*`k__H3O+A`^2)*H2O^2/(`k__H3O+OH`*`k__H3O+A`*((-`k__A+H2O`-`k__HA+H2O`)*`k__H3O+OH`+`k__A+H2O`*`k__H3O+A`))

(1)

``


 

Download Mapleprimes_-_Ionproduct.mw

is there example data that can verify maxwell equations?

How to calculate determinant of a cube matrix ?

is there function to calculate 3x 3x 3 cube determinant?

How to proof classical and quantum both p summation equal to one in maple?

is possible to solve these partial differential equations in maple via pdsolve?

Thanks

In an unrelated thread, I provided the OP with some 1-D code, which contained the Array definition

TC:= Array(0...1001, fill=0)

Note the existence of three '.' characters in the range specification. This was a typo on my part, or my '.' key bounced, or something. The code containing the above definition "worked" with no problem, which, presumably, was why I didn't notice.

The Maple help does state (my emphasis)

Note that more than two dots in succession are also parsed as the range (..) operator.

although I wasn't making use of this fact - I just screwed up when typing the original.

The OP preferred to use 2-D input, and used cut-and-paste to transfer the above code, resulting in 2-D input, which is where the fun started. It seems(?) that when using 2-D input, more than two dots in succession is only interpreted as a straightforward range, if the total number of dots is even.

If the total number of dots is odd, then it appears(?) as if the 'final' dot is associated with the second number in the range as a 'decimal point', (so producing .1001 in the above example). This is then 'coerced/rounded' to an integer - ie it becomes '0', and the above Array definition is interpreted as

TC:= Array(0..0, fill=0)

Consequences in the following code are left to your imagination

Worth an SCR?

 

 

 

K := simplify(C, 'size');
      5                                                  4   
lambda  + (-a__11 - a__33 - a__44 - a__55 - a__22) lambda  + 

  ((a__44 + a__33 + a__22 + a__11) a__55

   + a__44 (a__33 + a__22 + a__11) + (a__33 + a__22) a__11

                                      3                    
   + a__33 a__22 - a__32 a__23) lambda  + (((-a__33 - a__22

   - a__11) a__44 + (-a__33 - a__22) a__11 - a__33 a__22

   + a__32 a__23) a__55

   + ((-a__33 - a__22) a__11 - a__33 a__22 + a__32 a__23) a__44

   + (-a__22 a__33 + a__23 a__32) a__11

                                              2            
   - a__32 (a__13 a__21 + a__24 a__43)) lambda  + ((((a__33

   + a__22) a__11 + a__33 a__22 - a__32 a__23) a__44

   + (a__22 a__33 - a__23 a__32) a__11

   + a__32 (a__13 a__21 + a__24 a__43)) a__55

   + ((a__22 a__33 - a__23 a__32) a__11 + a__13 a__21 a__32) a__44

   + a__32 (a__11 a__43 a__24 - a__21 (a__14 a__43 + a__15 a__53)

  )) lambda + (((-a__22 a__33 + a__23 a__32) a__11

   - a__13 a__21 a__32) a__44

   - a__43 a__32 (a__11 a__24 - a__14 a__21)) a__55

   - a__15 a__21 a__32 (a__43 a__54 - a__44 a__53)

u := [coeffs(K, [lambda], 'l')];
[(((-a__22 a__33 + a__23 a__32) a__11 - a__13 a__21 a__32) a__44

   - a__43 a__32 (a__11 a__24 - a__14 a__21)) a__55

   - a__15 a__21 a__32 (a__43 a__54 - a__44 a__53), 1, 

  -a__11 - a__33 - a__44 - a__55 - a__22, (a__44 + a__33 + a__22

   + a__11) a__55 + a__44 (a__33 + a__22 + a__11)

   + (a__33 + a__22) a__11 + a__33 a__22 - a__32 a__23, ((-a__33

   - a__22 - a__11) a__44 + (-a__33 - a__22) a__11 - a__33 a__22

   + a__32 a__23) a__55

   + ((-a__33 - a__22) a__11 - a__33 a__22 + a__32 a__23) a__44

   + (-a__22 a__33 + a__23 a__32) a__11

   - a__32 (a__13 a__21 + a__24 a__43), (((a__33 + a__22) a__11

   + a__33 a__22 - a__32 a__23) a__44

   + (a__22 a__33 - a__23 a__32) a__11

   + a__32 (a__13 a__21 + a__24 a__43)) a__55

   + ((a__22 a__33 - a__23 a__32) a__11 + a__13 a__21 a__32) a__44

   + a__32 (a__11 a__43 a__24 - a__21 (a__14 a__43 + a__15 a__53)

  )]
u[1] = C__5;
(((-a__22 a__33 + a__23 a__32) a__11 - a__13 a__21 a__32) a__44

   - a__43 a__32 (a__11 a__24 - a__14 a__21)) a__55

   - a__15 a__21 a__32 (a__43 a__54 - a__44 a__53) = C__5
C__1 = u[3];
         C__1 = -a__11 - a__33 - a__44 - a__55 - a__22
C__2 = u[4];
   C__2 = (a__44 + a__33 + a__22 + a__11) a__55

      + a__44 (a__33 + a__22 + a__11) + (a__33 + a__22) a__11

      + a__33 a__22 - a__32 a__23
C__3 = u[5];
C__3 = ((-a__33 - a__22 - a__11) a__44 + (-a__33 - a__22) a__11

   - a__33 a__22 + a__32 a__23) a__55

   + ((-a__33 - a__22) a__11 - a__33 a__22 + a__32 a__23) a__44

   + (-a__22 a__33 + a__23 a__32) a__11

   - a__32 (a__13 a__21 + a__24 a__43)
C__4 = u[6];
C__4 = (((a__33 + a__22) a__11 + a__33 a__22 - a__32 a__23) a__44

   + (a__22 a__33 - a__23 a__32) a__11

   + a__32 (a__13 a__21 + a__24 a__43)) a__55

   + ((a__22 a__33 - a__23 a__32) a__11 + a__13 a__21 a__32) a__44

   + a__32 (a__11 a__43 a__24 - a__21 (a__14 a__43 + a__15 a__53)

  )
 

I am trying to solve a diffusion equation with a potential term that has an integral in it. The equation has the following form: 

PDE := diff(g(x, t), t) = diff((beta(x, t)+diff(g(x, t), x)), x), 

with the function beta: 

beta := proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = -infinity .. +infinity) end proc

The boundary conditions for the function g(x,t) are simply assumed to be a zero-centered Gaussian in space (i.e. in x). So it is unity for x=0 and zero for the outer boundary that we can set as x=L. 

The problem is easily solved if the function beta is not an integral, but in the current form I get the following error: 
*******
Error, (in pdsolve/numeric/process_PDEs) inconsistent dependencies in PDEs: g(x, t) v.s. g(y, t)

*******

So it does not like the dummy variable in the function g.  

I can not write an additional PDE for beta because my Kernel is an exponential so the integral never goes away. Anyone with a way to solve this?

ADDENDUM: I have now copied the scriptPDE_DIFFUSION_INTEGRAL.mw
 

restart

L := 20; betaz := proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = 0 .. L) end proc

proc (x, t) options operator, arrow; int(exp(-abs(x-y))*g(y, t), y = 0 .. L) end proc

(1)

PDE := diff(g(x, t), t) = diff(-betaz(x, t)+diff(g(x, t), x), x)

diff(g(x, t), t) = -(int(-abs(1, x-y)*exp(-abs(x-y))*g(y, t), y = 0 .. 20))+diff(diff(g(x, t), x), x)

(2)

v__t := 1; v__d := 0; IBC := {g(0, t) = exp(-(0.-v__d)^2/v__t), g(L, t) = 0*exp(-(L-v__d)^2/v__t), g(x, 0) = exp(-(x-v__d)^2/v__t)}

{g(0, t) = 1., g(20, t) = 0, g(x, 0) = exp(-x^2)}

(3)

pds := pdsolve(PDE, IBC, numeric, time = 100, range = 0 .. L, spacestep = .1)

Error, (in pdsolve/numeric/process_PDEs) inconsistent dependencies in PDEs: g(x, t) v.s. g(y, t)

 

p0 := pds:-plot(t = 0, numpoints = 100, color = red); p1 := pds:-plot(t = 10, numpoints = 100, color = red); p2 := pds:-plot(t = 20, numpoints = 100, color = blue); p6 := pds:-plot(t = 60, numpoints = 100, color = blue); p5 := pds:-plot(t = 50, numpoints = 100, color = blue); p3 := pds:-plot(t = 30, numpoints = 100, color = blue); p4 := pds:-plot(t = 40, numpoints = 100, color = green); p7 := pds:-plot(t = 70, numpoints = 100, color = blue); p8 := pds:-plot(t = 80, numpoints = 100, color = black); p9 := pds:-plot(t = 90, numpoints = 100, color = blue); plots[display]({p0, p2, p4, p8})

NULL


 

Download PDE_DIFFUSION_INTEGRAL.mw

below. 

 
First 119 120 121 122 123 124 125 Last Page 121 of 2218