MaplePrimes Questions

I know how to define a procedure and use print() as follows:

test := proc (x)
  print("x is equal to: ");
  x
end proc

This displays as follows:
test(2)

"x is equal to: "

2

But i would like to appear as follows:

x is equal to: 2

 

Where the "x is equal to: "-part is standard a "text-mode-block" with green color.

Can i accomplish this in Maple, and can i do more advanced formatting?

 

Best regards,

Martin

hi,

    In my note,i use Simplify or map(Simplify,eqs) to make the expression more simple,but i meet a fail,the answers i got lies two diffrent between Eq.(8) and Eq.(9) caused by last term ,i guess it's a bug in using Physics package,if not,how can i do, please tell me.

thanks.

NULL

restart; with(Physics); Setup(mathematicalnotation = true); Physics:-Version()[2]

`2014, January 6, 3:40 hours`

(1)

Setup(op = {a, ap})

`* Partial match of  'op' against keyword 'quantumoperators'`

 

[quantumoperators = {a, ap}]

(2)

ap := Dagger(a)

Physics:-Dagger(a)

(3)

Setup(alg = {%Commutator(a, ap) = 1})

`* Partial match of  'alg' against keyword 'algebrarules'`

 

[algebrarules = {%Commutator(a, %Dagger(a)) = 1}]

(4)

``

N := Physics:-`*`(ap, a)

Physics:-`*`(Physics:-Dagger(a), a)

(5)

K__0 := Physics:-`*`(ap, a)+1/2; 1; K__d := Physics:-`*`(a, sqrt(N)); 1; K__u := Dagger(K__d)

Physics:-`*`(Physics:-Dagger(a), a)+1/2

 

Physics:-`*`(a, Physics:-`*`(Physics:-Dagger(a), a)^(1/2))

 

Physics:-`*`(Physics:-`*`(Physics:-Dagger(a), a)^(1/2), Physics:-Dagger(a))

(6)

C := K__0^2-Physics:-`*`(Physics:-`*`(K__d, K__u)+Physics:-`*`(K__u, K__d), 1/2)

Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a)+1/2, 2)-(1/2)*Physics:-`*`(a, Physics:-Dagger(a), a, Physics:-Dagger(a))-(1/2)*Physics:-`*`(Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2), Physics:-Dagger(a), a, Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2))

(7)

ans1 := Simplify(C)

1/4-(3/2)*Physics:-`*`(a, Physics:-Dagger(a))+(1/2)*Physics:-`*`(Physics:-`^`(a, 2), Physics:-`^`(Physics:-Dagger(a), 2))-(1/2)*Physics:-`^`(-1+Physics:-`*`(a, Physics:-Dagger(a)), 3/2)

(8)

ans2 := map(Simplify, C)

1/4-2*Physics:-`*`(a, Physics:-Dagger(a))+Physics:-`*`(Physics:-`^`(a, 2), Physics:-`^`(Physics:-Dagger(a), 2))-(1/2)*Physics:-`*`(a, Physics:-Dagger(a), a, Physics:-Dagger(a))-(1/2)*Physics:-`*`(Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2), Physics:-Dagger(a), a, Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2))

(9)

Term3 := op(3, C)

-(1/2)*Physics:-`*`(Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2), Physics:-Dagger(a), a, Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2))

(10)

Simplify(Term3) = -Physics:-`*`(Physics:-`*`(ap, a)^2, 1/2)

-(1/2)*Physics:-`*`(Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2), Physics:-Dagger(a), a, Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 1/2)) = -(1/2)*Physics:-`^`(Physics:-`*`(Physics:-Dagger(a), a), 2)

(11)

ans3 := Simplify(subsop(3 = -Physics:-`*`(Physics:-`*`(ap, a)^2, 1/2), C))

-1/4

(12)

  
"here,we can find a quite difference between Eq.(8) and Eq.(9)."

obviously,there lies a wrong result at last term in Eq.(8).

  The question is how we can simplify the style as last term in Eq.(9) even the soft can work correctly.

  yes,i want get a result from lhs(11) to rhs(11) through 'Simplify',in fact,in quantum operator computation,we can meet much more like sqrt(ap*a)*ap*a*sqrt(ap*a),exp(ap*a)*ap*a*exp(-ap*a),sin(ap*a)*a*ap*sin(ap*a),etc.if happen,can we  make this more simple with soft?

 

NULL

NULL



Download question_13.12.29.mw

Why does the act of multiplying a vector or a matrix with zero produce not a zero vector or a zero matrix, but in both cases zero scalarly? An example:

Vector(4),
Matrix(4),
0*Vector(4),
0*Matrix(4);

Mathematically it makes no proper sense, and annoyingly it forces one to make some special code-adjustments to treat differently nonzero- and zero multiplication.

Important (note added): The problem is present only when the Physics package is loaded, see comment below.

Complex conjugation of a product of Grassmannians is defined to reverse the order of the multiplicands (while also complex conjugating each multiplicand by itself, of course). That does not seem to be implemented in the Physics package: The code

with(Physics):
Setup(
   mathematicalnotation = true,
   anticommutativepre   = theta
):
a := theta1*theta2;
b := conjugate(a);
c := evalc(b);

produces for a, b, and c the following results:

In b and c, the order of the multiplicands should be the reverse, or, equivalently, the signs of b and c should be the opposite. Is it due to an error, or due to not being implemented yet, or have I simply misunderstood something?

The following code of mine, which no doubt may be improved, performs this generalized conjugation (note that reversing a product of c-number-valued, i.e., commutative, quantities is, of course, inconsequential, and thus usual complex conjugation is maintained):

Conj := proc(x::algebraic)
    local expr;
    expr := expand(x);
    if   type(expr,`+`) then map(Conj,expr)
    elif type(expr,`*`) then `*`(ListTools:-Reverse(map(Conj,[op(expr)]))[]);
    else conjugate(expr)
    end if
end proc:

I want to define a band matrix using n vectors. Detial given maple sheet. please help me

Help.mw

I want to define a matrix of M by M which have some condition. detail given in maple file. please help me.

Help_Maple-1.mw

I explain the required matrix by taking some example hope you will be understand. Please make it quickly... I will be very thank full. Help_Maple-1.mw

I wan to define a square matrix for M and r detial given in Maple sheet. Please Help....Help_Maple.mwHelp_Maple.mw

Is it possible that this expression has an elementary one (specifically the dilog's):

Y0:=(1/16)*(s*t*(exp(2*t)*s+exp(4*t)+1)*ln((exp(2*t)*s-(-s^2+1)^(1/2)+1)^16*(1+(-s^2+1)^(1/2))^16/((exp(2*t)*s+(-s^2+1)^(1/2)+1)^16*(1-(-s^2+1)^(1/2))^16))+s^3*t*(exp(4*t)+1)*ln((exp(2*t)*s-(-s^2+1)^(1/2)+1)^8*(1+(-s^2+1)^(1/2))^8/((exp(2*t)*s+(-s^2+1)^(1/2)+1)^8*(1-(-s^2+1)^(1/2))^8))+exp(2*t)*t*ln((exp(2*t)*s-(-s^2+1)^(1/2)+1)^32*(1+(-s^2+1)^(1/2))^32/((exp(2*t)*s+(-s^2+1)^(1/2)+1)^32*(1-(-s^2+1)^(1/2))^32))+4*((exp(4*t)+1)*s+2*exp(2*t))*(s^2+2)*dilog((-exp(2*t)*s+(-s^2+1)^(1/2)-1)/(-1+(-s^2+1)^(1/2)))-4*((exp(4*t)+1)*s+2*exp(2*t))*(s^2+2)*dilog((exp(2*t)*s+(-s^2+1)^(1/2)+1)/(1+(-s^2+1)^(1/2)))+((32*s^2*t+64*t)*exp(2*t)+16*(((t+1/8)*s^2+2*t+2)*exp(4*t)-(5/4)*s*exp(-2*t)-(1/8)*exp(-4*t)*s^2+(5/4)*s*exp(6*t)+(1/8)*s^2*exp(8*t)+(t-1/8)*s^2-2+2*t)*s)*arctanh((exp(2*t)-1)*(-1+s)/((-s^2+1)^(1/2)*(exp(2*t)+1)))+8*(-s^2+1)^(1/2)*((1/8)*s*(exp(4*t)+1)*ln((exp(4*t)*s+2*exp(2*t)+s)^12/s^12)+(1/8)*exp(2*t)*ln((exp(4*t)*s+2*exp(2*t)+s)^24/s^24)+(s^2-6*t-3)*exp(2*t)+((-(1/8)*s^2-3*t)*exp(4*t)+s*exp(-2*t)+(1/8)*exp(-4*t)*s^2+s*exp(6*t)+(1/8)*s^2*exp(8*t)-(1/8)*s^2-3*t)*s))/((s*exp(-2*t)+exp(2*t)*s+2)*(exp(4*t)*s+2*exp(2*t)+s)*((-s^2+1)^(1/2)+2*arctanh((-1+s)/(-s^2+1)^(1/2))))

Also I'm wondering since Y0 should solve the ode

-(diff(diff(y(t), t), t))+(4-12/(1+s*cosh(2*t))+8*(-s^2+1)/(1+s*cosh(2*t))^2)*y(t) = C/(1+s*cosh(2*t))

with some constant C but I only get rubbish.

I ask this because I found that in another context this seems to be correct:

f1:=-(1/12)*Pi^2*((-s^2+1)^(1/2)-arccosh(1/s))/(-s^2+1)^(3/2)+(1/12)*arccosh(1/s)^3/(-s^2+1)^(3/2)-(1/4)*arccosh(1/s)^2/(-s^2+1)

f2:=(1/2)*((-s^2+1)^(1/2)*(polylog(2, s/(-1+(-s^2+1)^(1/2)))+polylog(2, -s/(1+(-s^2+1)^(1/2))))-polylog(3, s/(-1+(-s^2+1)^(1/2)))+polylog(3, -s/(1+(-s^2+1)^(1/2))))/(-s^2+1)^(3/2)

and f1=f2

but maple doesnt convert it.

Also maple has trouble to convert

2*arctanh(sqrt((1-s)/(1+s)))=arccosh(1/s)

everywhere: 0<s<1

Aslam-u-Alikum. How are you. I want to make band matrix by using two vector. Detail given in Maple fine also. Please help me urgent.Help.mw

Is it possible to find the limit
limit(int(x*cos(x)/(1+3*sin(n*x)^2), x = 0 .. Pi), n = infinity)assuming n::posint
with Maple?
Calculations suggest the one equals -1.

Hello

I calculated following two expressions, x1,and x2.

x1:=map(f,a+b);

x2:=map(f,y=a+b);

 

The results of these are

f(a) + f(b)

f(y) = f(a + b)

for each. And, I can understand the logic of this.

 

If I want to derive the result of x2 as f(y)=f(a)+f(b), how should I do about x2?

Isn't there other way than to write

map(f, lhs(x2))=map(f,rhs(x2))

?

Please teach me this.

Thank you in advance.

Taro

 

 

How can I get maple to integrate this expression numerically.

For a specific value 0<s<1 it should be enough to integrate from -40..40 instead of -infinity..infinity

Anyway. My maple version always hangs up :-(

(1/2)*(-4*dilog(-(exp(2*t)*s-(-s^2+1)^(1/2)+1)/(-1+(-s^2+1)^(1/2)))*exp(4*t)+arctanh((-1+s)/(-s^2+1)^(1/2))*s^2+arctanh((exp(2*t)*s-exp(2*t)-s+1)/((exp(2*t)+1)*(-s^2+1)^(1/2)))*s^2+8*(-s^2+1)^(1/2)*exp(4*t)+4*dilog((exp(2*t)*s+(-s^2+1)^(1/2)+1)/(1+(-s^2+1)^(1/2)))*exp(4*t)+4*exp(4*t)*arctanh((-1+s)/(-s^2+1)^(1/2))-8*arctanh((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4*t)+6*(-s^2+1)^(1/2)*ln(s)*exp(4*t)-2*dilog(-(exp(2*t)*s-(-s^2+1)^(1/2)+1)/(-1+(-s^2+1)^(1/2)))*exp(4*t)*s^2)/((-s^2+1)^(1/2)*exp(8*t)*s^2-2*arctanh((-s^2+1)^(1/2)/(1+s))*exp(8*t)*s^2+4*(-s^2+1)^(1/2)*exp(6*t)*s-8*arctanh((-s^2+1)^(1/2)/(1+s))*exp(6*t)*s+2*(-s^2+1)^(1/2)*exp(4*t)*s^2-4*arctanh((-s^2+1)^(1/2)/(1+s))*exp(4*t)*s^2+4*(-s^2+1)^(1/2)*exp(4*t)-8*arctanh((-s^2+1)^(1/2)/(1+s))*exp(4*t)+4*(-s^2+1)^(1/2)*exp(2*t)*s-8*arctanh((-s^2+1)^(1/2)/(1+s))*exp(2*t)*s+(-s^2+1)^(1/2)*s^2-2*arctanh((-s^2+1)^(1/2)/(1+s))*s^2)

I have an equation as follows:

By inspection one can see that the last three terms can be simplified (factored) to

How can I coerce Maple to do this? None of the available tools seem to be getting close to this. A partial solution is like this: Writ a procedure as follows:

Fac:=proc(xpr,a,b);
  tmp:=xpr+(a^2+2*a*b+b^2);
  return tmp-(a+b)^2;
end proc;

and then call it:

Fac(lhs(eq),k0,2*Pi*n/L)=rhs(eq);

to get

which is what I want. But procedure Fac() is not general at all; e.g. it fails if the overall sign of the polynomial terms are different. There does not seem to be any way in Maple to determine the sign of a term in the sum of lhs(eq), I can only find ways to determine signs of a simple indeterminate. I'd like to make this procedure more general (which is trivial enough for a human) but I just cannot find any tools in Maple to support this.

Any ideas out there?

Mac Dude.

 

after a matrix operation, the result is not exactly the matrix i want

there is around 0.0001 difference difference in all element in matrix

how to deal with this random difference in order to be exact?

First 1484 1485 1486 1487 1488 1489 1490 Last Page 1486 of 2434