## How do I run coding with goto on Maple? ...

Hi, I'm using Maple 2018 and I tried to run coding from https://www.maplesoft.com/applications/view.aspx?sid=4194&view=html

however, it said : unable to parse. I figured out that the problem maybe is in the if loop. though it seems perfectly fine, but it has some goto commands that i cannot search on maple website. does this mean that the goto cannot be used here and should be replaced? if yes, then how?

i am still learning on how to use maple. any help would be much appreciated. thank you!

this is the coding for if loop:

label_7;

rv:=vector([p1(x1pt,x2pt),p2(x1pt,x2pt)]):

numgeval:=numgeval+1;

printf("%5d (%8.4f,%8.4f)",numIter,rv[1],rv[2]);

max:=n;

mg:=convert(sqrt(dotprod(rv,rv)),float);

printf("%12.4f",mg);

if(mg<tol or numIter>=max) then

goto(label_6);

else

numIter:=numIter+1;

fi;

v1:=x1pt+t*rv[1];

v2:=x2pt+t*rv[2];

newt:=evalf(subs({x1=v1,x2=v2},f1));

numfeval:=numfeval+1;

lam:=fsolve(diff(newt,t)=0,t,maxsols=1);

nv1:=evalf(subs({t=lam},v1));

nv2:=evalf(subs({t=lam},v2));

printf(" (%8.4f,%8.4f)%13.4f\n",x1pt,x2pt,lam);

x1pt:=nv1;

x2pt:=nv2;

goto(label_7);

label_6;

printf("\n\n-----------------------------------------");

printf("---------------------------------------------");

printf("\n\n Approximate Solution: ");

printf(" (%8.4f,%8.4f)\n",x1pt,x2pt);

Fvalue:=evalf(subs(x1=x1pt,x2=x2pt,f));

printf(" Maximum Functional Value: ");

printf("%21.4f",Fvalue);

printf("%22d",numgeval);

printf("\n Number function evaluations:");

printf("%22d",numfeval);

printf("\n\n-----------------------------------------");

printf("---------------------------------------------");

end:

## Derivative respect to a derivative variable: d L(...

If q := [q1(t),q2(t),q3(t)];

and L=cos(q1(t))+sin(q2(t))+5*dq1 + 4*dq3

now I want to get the result of the following expression

d(dL/d dq1)/dt=?,

how can i write the expression?

In above expression dq1 is the derivative of q1(t), and dq3 is that of q3(t),

## Asymptotic Notations...

How do I solve (1/2)*n^2 +2n-1=O(n^2) in maple2018?Thank you

## Why is this an error?...

curry(`?[]`,f)([1]);

## How can I snap a point in 3d figure and show the...

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 ？

## Permutations that satisfy conditions....

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

## Physics Package: How to define bracketrules for di...

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

-------

---------

Second try

---------

 (1)

 (2)

--------

Third try

--------

 (3)

 (4)

 (5)

## Use dot . in variable name...

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.

## How to plot vectors in 3D?...

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.

## how I can mix two plot curve into only one figure...

hi

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

Thank you

 >
 >

## Confiusing about solution in solve....

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 ?

## Not then, not now....

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?

## Calculating cotton tensor with the physics package...

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.

## Your graphing aps and instructions are not helping...

Where can I find help with graphing on Maple?

## How do I solve a differential equation with recurs...

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