## 110 Reputation

6 years, 149 days

## How to use convert/Diff with eval...

Maple 2018

Hi all,

I have an differential equation in terms of the D-operator and am trying to convert it to diff form. Using convert/Diff works fine as long as partially evaluated functions don't appear in the equation. However, I can't figure out how to get the two to cooperate.

For instance, running

```D[2](eta)(t,x)+D[2](phi)(t,x,0)+D[2](phi)(t,x,0):
convert(%, Diff);```

returns

`D[2](eta)(t,x) + Diff(phi(t,x,0),x)`

Why is the eta term not converted to diff(eta(t,x),x)?

Thanks a lot!

## Bug in Physics metric?...

Maple 2018

Hi all,

I found some strange behavior while usings tensors from Physics; I wanted to make sure I wasn't missing something here.

It seems that changing the metric (for instance, to +++-) causes raising and lowering problems. As an example:

```with(Physics):
Setup(metric=`+++-`):

# Define our system of equations
Coordinates(X):

# Define tensors
{U[~mu] = [u(X),0,0,1],
A[~mu]=[0,0,0,n(X)]}:
Define(op(%)):

F[mu,nu]=d_[mu](A[nu]) - d_[nu](A[mu]):
Define(%):

# Multiply tensors
TensorArray(F[~0,~mu].U[mu]);

```

This produces

`-diff(n(X),x1)*u(X)-2*diff(n(X),x4)`

However, only the first term should be present. It seems that changing the mulitplication to F[0,~mu].U[mu] produces the correct output, as does removing the Setup call. Also, manually defining F produces the expected output; only defining it via A seems to generate the discrepancy.

Any idea if this is a bug or a feature?

Thanks!

## Using Physics inside a procedure...

Maple 2018

Hello!

I can't seem to figure out how to use the Physics package within a procedure. In particular, I can't get tensors to be recognized within the body of the proc.

As an example, here's a short program that works correctly when not in a procedure:

```with(Physics):
Coordinates(X,quiet):
d_[mu](X[~mu]);
# Returns 4; Correct```

However, placing this code inside a proc causes the tensor X to not be recognized as a tensor:

```Test := proc()
uses Physics:

Coordinates(X,quiet):
d_[mu](X[~mu]);
end proc:
Test();
# Returns 0; Wrong```

Apparently, Physics:-Coordinates still defines the tensor X (as can be checked by calling Physics:-Define()). However, the derivative d_[mu] (X[~mu]) seems to be treating X as a standard symbol. Any idea how I would go about correcting this?

Thanks!

## How to evaluate arguments after passing ...

Maple 2017

Hello,

I've been using the invhilbert procedure from the inttrans package, but I'm running into a small problem. I'm attempting to apply invhilbert to an unknown function, and then later evaluate that function. However, in one particular case (bad, below), it does not produce the expected output. Curiously, I noticed that if I did *two* substitutions (good, below), it produces the expected result.

```with(inttrans):

pde := inttrans:-invhilbert(f(t,s),s,x):
def := g = ((t) -> exp(t)*sin(B)):

bad := f = ((t,x) -> (1 + exp(t)*sin(B))*sin(x+A)):
good := f = ((t,x) -> (1 + g(t))*sin(x+A)):

eval['recurse'](pde, [good,def]);
# -cos(A) exp(t) sin(B) cos(x) + sin(A) exp(t) sin(B) sin(x) - cos(A) cos(x) + sin(A) sin(x)
# -exp(t) sin(B) cos(x) + sin(A) sin(x) - cos(A) cos(x)
```

As a side-note: this discrepancy was very delicate. Removing any of terms (for instance, A) causes both to give the same, correct answer.

For this particular problem, I was able to manually replace exp(t)*sin(b) with the function g(t) and get the correct result, but I was hoping for a more automated approach (I need to apply it to many equations). Is there any way to get the correct result from equation bad?

Thank you very much!

## How to partially expand a trig identity...

Maple 2017

Hello,

I've been trying to figure out how to partially expand a trig function using the sum-rule but not the multiple-angle rule. For instance, I would like to expand

`sin(2*x+3*y)`

to

`sin(2*x)*cos(3*y) + cos(2*x)*sin(3*y)`

Unfortunately, expand also uses the multiple-angle rules, which is unwanted. The trigsubs command looked promising, but I don't know the names of the variables (x and y here) a priori, so I believe I need something with type matching (like applyrule with x::monomial + y::monomial).