MaplePrimes Questions

I want to collect a two terms expression x/2+y/2.

But, I cannot do it as follows.

> x/2+y/2;

> normal(%);

>factor(%)

result was 1/2*x+1/2*y.

With which can I have maple modify the above expression to (x+y)/2.

 

Thank you in advance.

taro

 

 

 

 

what is the name of this decomposition?

Y = S^-1*X*S, where S is unitary fourier transform

do maple have function to solve this?

I want to solve following PDE question with forward difference method inn Maple. Can you help me please?

 

du/dt=d^2u/dx^2, 0<x<2, t>0

u(x,0)=sin(2*pi*x)

u(0,t)=0, u(2,t)=0

 

Use h=0.4 and k=0.1. and compare your answers at  t=0.5 to the exact solution u(x,t)=exp(-4*pi^2*t)*sin(2pi*x). Then use h=0.4 and k=0.05,and compare the answers. 

How to calculate a matrix's self adjoint matrix if given any matrix?

 

<Px, y> = <x, Py>

hermitian is a kind of self adjoint

L:=Matrix(H,shape=hermitian);

is above command convert a general matrix H into self adjoint L?

any other methods

Greetings to all.

The multiplicative partition function is defined here at Wikipedia and was recently the subject of a discussion at Math Stackexchange.

I posted two solutions to the task of computing this function at the above page that use Maple code. One of them employs the Polya Enumeration Theorem and is of mostly theoretical interest as it cannot be used to effectively compute the function for n with many factors. I posted two additional implementations in order to remedy this defect, one of them in Maple and the other in Perl. I think the Maple implementation is easy enough to read not to require additional commentary. Note, however, that even though the Maple code and the Perl code implement the same algorithm (dynamic programming), the Maple version is dramatically slower than the Perl version and consumes a lot of memory. E.g. Maple takes 58 seconds for the value for 9! and Perl takes 1.5 seconds.

My question is, can someone explain this difference? Note that both are interpreted languages so there is no gain due to potential compilations.

Your commentary is appreciated.

This is with Maple 15 (X86 64 LINUX).

Best regards,

Marko Riedel

Both eval and showstat show that a procedure `print/diff` exists, but I am having trouble figuring out when the procedure is invoked. I expect it to be invoked---like any other `print/` procedure---when diff is output as an unevaluated function call. So I enter,

debug(`print/diff`);
diff(f(x), x$2);

This does not produce any debug output. Why? Checking with lprint shows that the result does indeed contain diff as an unevaluated function call.

Hi MaplePrimers!

I have a simulation in MapleSIM, exported as a compiled procedure in maple using -LinkModel(), and -GetCompiledProc.

I'm trying to do parameter estimation on my MapleSIM model.  Within a optimization scheme, I call the MapleSIM model, and it will output a curve.  Using a least squares method, I compare this measurements to synthetic experimental data (I know the actual values), and generate an objective function.  The optimization algorithm will try different parameter values, and try to minimze the objective function.  When the curves are exactly the same, the objective function will be zero.

The problem I am having is certain parameter sets will cause the model to require very small steps.  I wish to put a timeout on these experiments, because speed is important.  However, I would also like to see the results up to the point of requiring very small steps.  For timeout, I was using code along the lines of:

out:= timelimit(30,cProc(params = PData)); #simulate with 30s limit

where PData are the parameter guessses, and cProc is the compiled MapleSim model.

I would like 'out' to be assigned whatever the results were after 30 seconds, even if the model had not finished integrating.

 

Thanks in advance for any help!

I am trying to solve a set of equations for a Fluid dynamics problem and I cannot get a result...Any ideas why?

rho := 1.184;
nu := 1.562*10^(-5);
ID := .15;
L := 24.5;
Kl := 12.69;
Ho := 50.52;
a := 2.1*10^(-5);
E := 0.1e-2; alpha := 1.05;

sys := {Re = ID*V/nu, hl = (f*L/ID+Kl)*V^2/(2*9.81), Vflow = (1/4)*Pi*ID^2*V, Hrequired = alpha*V^2/(2*9.81)+hl, Hrequired = -a*Vflow^2+Ho, 1/sqrt(f) = -1.8*log[10](6.9/Re+(E/(3.7))^1.11)};

solve(sys*{Re, V, f, hl, Vflow, Hrequired});
%;
Error, (in unknown) invalid input: Utilities:-SetEquations expects its 2nd argument, equations, to be of type set({boolean, algebraic, relation}), but received {{Re = (9603072983/1000000)*V, hl = (5096839959/100000000000)*((1633333333/10000000)*f+1269/100)*V^2, Vflow = (9/1600)*Pi*V, Hrequired = (5351681957/100000000000)*V^2+hl, Hrequired = -(21/1000000)*Vflow^2+1263/25, 1/f^(1/2) = -(9/5)*ln((69/10)/Re+27367561/250000000000)/ln(10)}}

 

Dear All,

 

I have a .txt file with a single line. I tried to import it using ImportMatrix commnad (e.g. ImportMatrix(filename)) but always got the incomplete data, 

I attach the file for further reference:

ConservationEq.txt 

 

Anything I am missing ?

 

Regards,

 

Satya

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

First 1479 1480 1481 1482 1483 1484 1485 Last Page 1481 of 2429