## 2228 Reputation

17 years, 169 days

## The same...

They are the same because

`Student:-Precalculus:-CompleteSquare((s-3-2*I)*(s-3+2*I));`

If the Student[Precalculus] package is not part of Maple 13, then equality of the two expressions can be ascertained by expansion:

```expand((s-3)^2 + 4);
expand((s-3-2*I)*(s-3+2*I));```

PS: In Maple 2017, which I am using, the denominator of the transform is the complete square version.

## Assume facility...

You can either do

```assume(alpha > 0):
sqrt(alpha^2);```

or

`sqrt(alpha^2) assuming alpha > 0;`

Just an example, of course, for alpha only. For further information, you can consult the help pages ?assume and ?assuming.

## Noncommutative...

As Carl points out, the Physics package might handle it. Using the noncommutativity option, at least the order of the factors may be controlled/retained:

```with(Physics):
Setup(noncommutativeprefix = {A,B,T,x,u});
expr := x[k+1] = (id - A*T)^(-1)*x[k] + (id - A*T)^(-1)*B*T*u[k+1];```

Here, I have entered the identity matrix as id, because to Maple, I is the complex imaginary unit. But manipulation of such expressions might be limited, as the following example illustrates:

`isolate(expr,x[k]);`

Here, one would obviously have wanted both sides of the equation being multiplied (from the left) by the factor (id - A*T).

So I don't know. Perhaps the expert on the Physics package, Edgardo Cheb-Terrab, can help you out. With Carl's appending of 'Physics' to the tags, Edgardo might notice your post. Although, having just checked, I cannot see that tag at the time of writing. I have, therefore, appended it myself.

## Using eval in conjunction with solve...

Do you mean something along the following lines?

```eqs := {PrimeLength,PrimeTime};
eqs := eval(eqs,{x = 1,tp = 0});
sol := solve(eqs);```

## Using op...

A suggestion:

```P := (x) -> op(0,x)[op(1,x) + 1,op(2,x)]:
Q := (x) -> op(0,x)[op(1,x),op(2,x) + 1]:
P(u(i,j));
Q(u(i,j));```

## Define my own transpose...

I think I would define my own transpose, something along the following lines [perhaps somebody can come up with something smarter]:

```mySubTranspose := proc(x::scalar)
if   x::complexcons then x
elif x::`+` then map(mySubTranspose,x)
elif x::`*` then map(mySubTranspose,x)
elif x::`.` then `.`(map(mySubTranspose,ListTools:-Reverse([op(x)]))[])
else `if`(op(0,x) = T,op(1,x),T(x))
end if
end proc:
myTranspose := (M::Matrix) -> map(mySubTranspose,LinearAlgebra:-Transpose(expr)):```

Example of use [where I have augmented your original matrix with some complex constants to illustrate that the function can deal also with such cases]:

```expr := Matrix(2,2,[[T(X) + 3*X - Q,2*A . X], [I*T(X) . T(A),Q]]);
myTranspose(expr);```

Note that T is a formal placeholder for Transpose.

PS: I would have liked to include images of the output of the example above, but it seems that I cannot make the copy-paste work, getting only some 'rtable-gibberish'.

## A variation...

This is not quite in the format you ask for, but rather presents the solution with Numbs and vals combined in corresponding pairs:

`select(x -> -2 < x[2] and x[2] < 3,ListTools:-Enumerate(R));`

## Using eval and algsubs...

You can do as follows:

```sol := dsolve({diff(y(t),t\$2) + w^2*y(t) = p/m*exp(-a*t),y(0) = 0,D(y)(0) = 0}):
algsubs(n*w = a,simplify(eval(sol,{a = n*w,p = m*w^2*u})));```

## Solve directly...

You could do as follows:

```solve(
+    int(14*t*exp(-t/3),t=0..a)
-0.9*int(14*t*exp(-t/3),t=0..infinity)
,a);```

choosing the positive value of a.

## No iteration needed...

Why not simply do as follows?

`(factor@coeff)~(F,[a[2],a[1],a[0]]);`

or

`map2(factor@coeff,F,[a[2],a[1],a[0]]);`

## Reflection...

Perhaps I am misunderstanding what you have in mind, but is "the mirror image of the Heaviside function" not simply Heaviside(-t)?, compare the plots:

```plot(Heaviside(+t),t);
plot(Heaviside(-t),t);```

## A suggestion...

Solving as a second order differential equation with boundary conditions:

```with(VectorCalculus):
r(t) := <x(t),y(t),z(t)>:
eval(r(t),dsolve({
diff(r(t),t\$2) - <4*t,sin(t),cos(2*t)>,
eval(diff(r(t),t),t = 0) = <1,0,0>,   # Boundary condition for v(t)
eval(     r(t)   ,t = 0) = <0,1,0>    # Boundary condition for r(t)
}));```

## SumOverRepeatedIndices...

The SumOverRepeatedIndices in the Physics package may have your interest.

First 1.) set up a 9-dimensional (to use your example) manifold with positive definite metric (so that there is no difference between lower and upper indices) and lowercaselatin indices, and 2.) define R, U, V, and W as tensors:

```with(Physics):
Setup(
dimension = 9,
signature = `+`,
spacetimeindices = lowercaselatin
mathematicalnotation = true,
);
Define(R,U,V,W);```

Next, define F, although without the scalar factors (see problem below):

```F := R[i,m]*R[k,m]*(
+U[i,j]*U[k,j]
+U[i,j]*V[k,j]
+V[i,j]*V[k,j]
+W[i,j]*W[k,j]
);```

Now, the summation can be made explicit using the aforementioned command:

`expr := SumOverRepeatedIndices(F):`

I recommend not outputting expr, that is, using colon to terminate the line.

Problem: If the scalar factors are included into F, to make it complete, then SumOverRepeatedIndices 'fails': it does not evaluate these factors when performing the sum. I do not know whether that behaviour is intentional by design. But perhaps it has to be so, for if the Einstein summation convention is used, which it is by SumOverRepeatedIndices, I suppose, then the indices have to match in pairs, which they do not if these scalar factors are included.

Solution(?): Although perhaps not pretty, if you could absorb various square roots of 1/(2m+1) and 1/(2j+1) into R, U, V, and W, that is, rescale the columns of these quantities, then the summation problem would be solved, I guess.

## Using Matrix...

A variation on Carl's solution, using the Matrix constructor perhaps:

`Matrix(3,3,(i,j) -> N[10*i + j]);`

## Getting started...

Concerning question 1: For me, basic tabulation works as indentation. The amount of spaces inserted can be controlled under Utilities, Global Options, Tab width.

Concerning question 2: The easiest way, I think, is to use the read command in Maple, see the help page ?read. Code what you would like in jEdit, and then simply read it into Maple. Remember to terminate the read statement line with a semicolon to have printed output.

Concerning question 3: Importing a document from Maple into jEdit may be a distressing experience, if the Maple document is 'contaminated' with XML-code, which, I guess, any code is from Maple 11 onwards, compare my (old) post I declare defeat: rolling back to Maple 9.5. Although somewhat a hazzle, I usually copy-paste execution groups one by one into jEdit, performing at the same time any finishing formatting of the code (for instance indentation by proper tabbing, which is no longer possible in Maple).

Concerning question 4: I have never used \$include, having always found that the read and with commands, in conjunction with the construction of my own packages, was sufficient. Perhaps others can help you out concerning \$include.

 1 2 3 4 5 6 7 Last Page 3 of 19
﻿