## 12685 Reputation

8 years, 265 days

## op...

convert(s, list)  simply returns [op(s)]  i.e. the list of the operands, see ?type,series.
It seems that you are mainly interested in Taylor series. In this case, you may use

s:=series(10/(1-x^2)^2, x, 10);
s := 10+20*x^2+30*x^4+40*x^6+50*x^8+O(x^10)
PolynomialTools:-CoefficientList(convert(s,polynom),x);
[10, 0, 20, 0, 30, 0, 40, 0, 50]

## simplify...

Definitely, simplify & co must be revised, as pointed out in this forum several times.
Even very simple 0 expressions are not recognized!

 > f:= (exp(2*x)-1)/(exp(2*x)+1);
 (1)
 > simplify(f - tanh(x));  # ?
 (2)
 > is(f - tanh(x) = 0);
 (3)

## You probably want...

You probably want:

```L[1, 0] := t + Pi*t/2 + (4*t^(3/2))/3:
L[2, 0] := t^(1/2) + Pi*t/4:
ans := int((L[1, 0] + L[2, 0])/(x - t)^(1/2), t = 0 .. x) assuming x>0;```

## Simply solve...

```solve([f, diff(f,x)], explicit); # x1=x2;  (f is the polynomial);
evalf(%);```

## T2...

Remove or comment the first line    afa := 0.277

```J := Int(T2, [y=-Pi/6+afa..Pi/6, x=0..Pi/2], method = _CubaCuhre, epsilon = 1e-2):
afa:=0.277:
'afa'=afa, 'T2'=evalf( eval(T2, [y=afa, x=Pi/4]) );
#               afa = 0.277, T2 = 2.35384223415597*10^9

evalf(J);
#               1.83729944313523*10^9 + 0.*I

forget(evalf);
afa := 0.13;
evalf(J);
#                   afa := 0.13
#                   2.69229399550637*10^9 + 0.*I

forget(evalf);
afa := 0.33;
evalf(J);
#                          afa := 0.33
#                         1.54057599303060*10^9 + 0.*I

```

## global...

Just add global main_module;   (e.g. after local ... ;).

## A bug...

 > restart;

It seems to be a bug.
If we alter a bit the bindings, the result is as expected
For x=0, y=0  the results should be the same, but they are not!

 > use a=a+b in   use b=a-b in     a*b   end use             #   ==>   a*(a-b)   end use;              #   ==>   (a+b)*a              ##??
 (1)
 > use a=a+b+x in   use b=a-b+y in     a*b                        end use             # ==>    a*(a-b+y) end use;              # ==>  (a+b+x)*(a+b+x -b +y)   ##OK
 (2)
 > eval(%,[x=0,y=0]);
 (3)

## Maybe this...

```expr:=1+3*diff(y(x),x):
select( has, ["itself"=expr, op(expr)], diff(y(x),x));
```

## solve...

It is simpler to just use the obvious:
solve(Determinant(A),w);

## sinh(x) / x...

Mathematicaly, you need the inverse of the function

f : (0, oo) -> (1, oo),  f(x) = sinh(x) / x.

The inverse exists, let's denote it by F : (1, oo) --> (0, oo);
it ca be developed in power series but cannot be expressed in terms of known functions.

Your equation has a unique positive solution  C = mu*g*a/F(L/(mu*g*a))
iff  L/(mu*g*a) > 1  (provided that your constants are >0).

## eliminate?...

It is not clear what "handle" means to you. If you want to eliminate x and sigma from A, then:

```S:=solve([sigma+x=a, sigma*x=b], [sigma,x]):
A1:=eval(A,S[1]); A2:=simplify(%);
```

Unfortunately, A is not rational (an "isolated" square root is there),. Also:

length(A1); length(A2);
1757
47950

## From general solution...

 > restart;
 > pde := diff(u(x,t),t) + u(x,t)*diff(u(x,t),x) = 0;
 (1)

The general solution is however correct:

 > pdsolve({pde});
 (2)

From here, one obtains for    pdsolve({pde,u(x,0)=f(x)});  # instead of  u(x,t)=0  :

 > sol:=f->RootOf((f@@(-1))(y)+y*t-x, y):   # or,
 > Sol:=f -> solve( (f@@(-1))(y)+y*t-x, y): # or,
 > SOL:=f -> solve( y - f(-y*t+x), y):
 >
 >
 >
 > # Now:
 > sol(exp); SOL(exp); Sol(exp);
 (3)
 > SOL(x->x);
 (4)
 > sol(sin); SOL(sin); Sol(sin);
 (5)
 > SOL(erf);
 (6)

## without assumptions...

```restart;
p := alpha -> alpha^m:
q := alpha -> alpha^n:
Sa := 1/2*int(p(alpha)*D(q)(alpha), alpha = 0 .. 1, continuous);```

## issues...

There are several issues in the worksheet.

1. You have the thype Z^+  (in 2D). It should be posint or nonnegint.
2. You have used m:type instead of m::type.  Note that ":" is a separator.
3.  assuming in the definition of p and q is not used (even when it is correctly inserted):

The assuming command does not scan programs regarding the presence of assumed variables; for that purpose use assume.

```restart;
assume(m>0, n>0);
p := alpha -> alpha^m;
q := alpha -> alpha^n;

Sa := eval(1/2*int(simplify(p(alpha)*D(q)(alpha)), alpha = 0 .. 1)); # actually eval is not needed
```

## StringTools...

```SUBS := [a,b,c], x, [2,4,5,1,a,4,5,a,b,434,a,b,c,5,5,5,1]:

X:= convert~([SUBS[1], SUBS[1][2..], SUBS[2..]], string):
parse(StringTools:-SubstituteAll(X[-1], X[1][2..-2], X[3]));
parse(StringTools:-SubstituteAll(X[-1], X[1][2..-2], cat(X[3],",",X[2][2..-2])));
```

[2, 4, 5, 1, a, 4, 5, a, b, 434, x, 5, 5, 5, 1]

[2, 4, 5, 1, a, 4, 5, a, b, 434, x, b, c, 5, 5, 5, 1]

 First 6 7 8 9 10 11 12 Last Page 8 of 113
﻿