MaplePrimes Questions

I have plotted a 3d figure with MAPLE. How can I snap a point in 3d figure and  show  the coordinate value of snaped point ?It  can be  carried out  easily in MATLAB,but I  cann‘t  snap the point used  point probe tool in MAPLE ?

Given 2 inputs
m = integer
c = integer

where c ≤ m/2

and variables, a_i, b_i, a, b (all non-negative integers)
Here, m is the digit length of a number where a_i and b_i represent digits in a number writen in base b. a is simply b-1 and is used as another digit.

I am interested in generating specific permutations of a_1 ... a_c  a ... a  b_c ... b_1 where the total number of digits is m and the number of a's in the centre is m-2c.

The permutations I am interested in satisfy the condition. a_i is to the left of b_j for i ≤ j


examples for m=7:
c=1
a1,a,a,a,a,a,b1

c=2
a1,a2,a,a,a,b2,b1
a1,a2,a,a,a,b1,b2
a1,b1,a,a,a,a2,b2
a2,a1,a,a,a,b1,b2
a2,a1,a,a,a,b2,b1

c=3
a1,a2,a3,a,b3,b2,b1
...

c=4
n/a   2c > m

I would like a function L(m,c) that creates all valid permuatations of a_1 .. a_c b_1 .. b_c  (2n terms)


I met up with a lecturer at my university and we came up with this code. Unfortunately it is for mathematica as he doesn't use Maple. I feel there may be a more efficient way than to generate all permutations and then delete some.

thank you in advance for any help.

Ben

Hi,

with the Physics package, I want to represent a discrete two-dimensional Hilbert space in a direct-product basis.

I have looked at https://www.mapleprimes.com/posts/209099-Tensor-Product-Of-Quantum-State-Spaces but am not sure how to implement bracketrules.

Let's assume I have one-dimensional bases A and B that span a two-dimensional space C. A is of size Na and B is of size Nb. Consequently, C is of size Na * Nb.

If I understand it correclty, this can be done with

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C})

First question: Is this correct and if yes, why do I need to specify quantumbasisdimension for C?

Then, I want to define, using bracketrules, <A[i]| <B[j]| |Psi> = X[i,j],

where |Psi> lives in the full, two-dimensional space C and X is a matrix.

<B[j]|Psi> would be a state living in A and <A[i]||Psi> would be a state in B.

How do I define this?

bracketrules = {%Bracket(Bra(A, i)*Bra(B, j), Ket(C, t)) = X[i,j](t)}

gives me an error.

I found a way using the nested expression

bracketrules = {%Bracket(Bra(A, i), Ket(A, j)) = X[i,j], %Bracket(Bra(B, j), Ket(C)) = Ket(A, j)}

giving

Bracket(Bra(A, i), Bracket(Bra(B, j), Ket(C, t))) = X[i,j]

but this is error prone, clumsy and only works in one direction:

Bracket(Bra(B, j), Bracket(Bra(A, i), Ket(C)))

does not work. Of course, I could also specify rules for the reverse direction but this is quite an effort for higher-dimensional spaces (I have, e.g., 9-dimensional spaces in mind).

So how do I do this properly?

Please have a look at the attached example, where I also included time-dependence.

Thanks,

Henrik

 


 

-------``

First try

-------

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i)*Bra(B, j), Ket(C, t)) = X[i, j](t)})

Error, (in Physics:-Setup) expected first argument in the Bracket defining a bracket rule to be a 'Bra'; received: Physics:-`*`(%Bra(A, i), %Bra(B, j))

 

 

---------

Second try

---------

 

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Bra(B, j), Ket(C, t)) = X[i, j](t)})

[bracketrules = {%Bracket(%Bra(A, i), %Bra(B, j), %Ket(C, t)) = X[i, j](t)}, disjointedspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}]

(1)

Bracket(Bra(A, i), Bra(B, j), Ket(C, t))

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), Physics:-Ket(C, t))

(2)

--------

Third try

--------

 

 

restart; restart, with(Physics)

Setup(hilbertspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Ket(A, j, t)) = X[i, j](t), %Bracket(Bra(B, j), Ket(C, t)) = Ket(A, j, t)})

[bracketrules = {%Bracket(%Bra(A, i), %Ket(A, j, t)) = X[i, j](t), %Bracket(%Bra(B, j), %Ket(C, t)) = Physics:-Ket(A, j, t)}, disjointedspaces = {{A, C}, {B, C}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C = 1 .. Na*Nb}, quantumdiscretebasis = {A, B, C}]

(3)

Bracket(Bra(A, i).Bra(B, j), Ket(C, t))

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), Physics:-Ket(C, t))

(4)

Bracket(Bra(A, i), Bracket(Bra(B, j), Ket(C, t)))

X[i, j](t)

(5)

Bracket(Bra(B, j), Bracket(Bra(A, i), Ket(C, t)))

Error, (in Physics:-Bracket) expected a Bra and a Ket as a first and last arguments, or no Bra and no Ket when using the shortcut notation; received: Physics:-Bra(B,j), Physics:-Bracket(Physics:-Bra(A,i),Physics:-Ket(C,t))

 

``


 

Download twoD.mw

 

How do you create a variable name with a dot?  ie/ ini.param

I don't think it's possible without using single quotes ie `ini.param`.  The single quotes will always need to be used.

I have 3 lists of equal length:

A:=[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5]
B:=[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5]
C:=[5,2,7,9,1,6,2,8,4,6,2,1,5,8,3,5,2,9,6,6,3,2,1,6,4]

I would like to make a 3-D plot of C dependent on A and B (Ex. C(1,1)=5, C(1,2)=2.. C(5,5)=4).

 

What would be the best way to plot this? I have tried 'pointplot3d' which returns a decent result, but I would prefer a filled plot if possible.

hi

I want to mix two curve and have only one figure(I want to compare two curve in one plot domain )?

Thank you

plot.mw
 

h1 := solve(Vdc = 0.1500000000e-2*sqrt(2.53669508*10^8*u^3-6.06101011*10^8*u^2+3.46343435*10^8*u), u); plot([h1], Vdc = 0 .. 11.5, color = [magenta], thickness = 1); plot(Vector([0, 3.38, 5.21, 6.97, 8.4108, 10.099, 10.9232, 11.8091]), Vector([0, 0.760e-1, .1275, .1994, .2286, .3222, .3637, .999]), style = point, symbol = asterisk, color = "Blue")

 

 

``


 

Download plot.mw

 

 

Hi, fairly simple question,

I solve a simple equation:

solve(x^x = 4, allsolutions, explicit);

#(2*(I*Pi*_Z7+ln(2)))/LambertW(_Z9, 2*ln(2)+(2*I)*Pi*_Z7)

Maple  gave me solution with prefix _Z for integer values, but why  _Z9 must be exactly equal  Zero  to be correct ?.

If _Z9 is integer it can also take other values than zero ?

Thanks in advance.



More information see attached file:

Download Allsolution.mw

 

There is a builtin command "callback". It exists both in Maple 5 and today's Maple. There is no documentation on it. What is it? Why does it exist? Is there any code that uses it?

Hi, fairly simple question,
I've been using the physics package to calculate various different tensors but I can't see that I can calculate a cotton tensor for a given metric, is this included in the physics package? If so what is the calling sequence as I cannot find it. I understand I could use the differential geometry package but I do not want to as I don't know how to set up an arbitrary metric, thanks in advance.

Where can I find help with graphing on Maple?

Hi there,

I have difficulties in solving the first partial derivatives dw/db and dw/dvarphi of this equation with its constraint:

w := exp(exp(x*b)*(r-1)/(1+varphi*exp(x*b))) where ln(r) = varphi*(exp(x*b))(r-1)/(1+varphi*exp(x*b))-1

Please help.

Regards,

Sarni Berliana

In a recent question (a few hours ago) Teep failed to compute quantiles of a negative binomial random variable as soon as the probability of success is small (even for a value of 0.05 the computational time is very prohibitive).
Teep used the package Statistics:

I discovered inadvertently that the package Student[Statistics] worked perfectly on the same problem, even for a success probability as small as 3e-10

What is the necessity to have two packages that share theoritically some features especially if one of them (Statistics) contains a lot of flaws and is not capable to return an answer as the other (Student[Statistics]) does?
In the present case of numerically computing quantiles, why people decide to implement a good algorithm in one package and a poor one in the other? Or why they didn't verify if the two packages gave identical answers on the same problem?

Hi all,

Anyone knows how to see a manual for DirectSearch:-GlobalSearch that explains what is done inside the function?

I tried to write "help(DirectSearch:-GlobalSearch)" and nothing. It opened an empty page written (no matches found). Is there any help for this function so I can know what's going on there?

More specifically, I'm trying solve the optimization probelm min(||Ax-b||_p) s.t. ||x||=1.

where A is a given matrix of size (n \times d)

b is a given vector of size (n \times 1)

p>0 is a scalar

and x is an unkown vector of size (d \times 1) that should be a unit vector.

I used DirectSearch:-GlobalSearch to solve this optimization problem. But since it's a non-convex optimization probelm, the function doesn't always return the optimal value. I want to read the manual of the function to understand what is done there and for which cases there are most chances that the function will not return the optimal value.

Thanks

 

Given any threshold value, I am interested in obtaining a quantity of interest using the inverse negative binomial distribution. This requires extracting the value from the discrete CDF and I am using the Quantile(X, threshold value) function.

The parameters of the NBD are given as r and p and the routine I have written (attached) works in some cases, but I have noticed that, for small values of p, the Maple program runs for excessive times to attempt to output the Quantile solution. For instance, if p = 0.3, the solution is fast but when p = 0.003, Maple continues to evaluate the solution with no result (I have interrupted computations after 2 hours).

In the attached example, p is set to 1.965 and r is 0.5. The threshold value is 0.98 and the associated solution, Q, for this value is determined to be Q=7.

Does anybody know how to help with this? I would be grateful for any help along the way. 


 

restart; with*Statistics; with(plots)

r := 1.965; p := .5

1.965

 

.5

(1)

with(Statistics)

R := RandomVariable(NegativeBinomial(r, p))

ProbabilityFunction(R, u)

Set the value of the CDF probability, α.

Evaluate the inverse CDF to return the quantity of interest, Q.

 

alpha := .98

.98

(2)

X := NegativeBinomialVariable(r, p); X := RandomVariable(NegativeBinomial(r, p))

CumulativeDistributionFunction(X, alpha)``

Q := Quantile(X, alpha)

7.

(3)

DensityPlot(X, title = "PDF")

 

plot(CDF(X, s), title = "CDF")

 

``

``NULL

``

``


 

 

Is it possible to output to the console without a new line being added. The code:

prints each number on a separate line. I want to print them all on the same line.

First 756 757 758 759 760 761 762 Last Page 758 of 2426