8 years, 17 days

## Why does dsolve return a solution with ...

Maple 2015

I don't understand why the solution of sys_2 isn't those of sys_1 when M__p=1 and M__a=0 ?

Traces of the computation seem to indicate that dsolve proceeds exactly the same for sys_2 and sys_1 .

Please note that sol_1 contains a term of the form t*cos(t) that sol_2 doesn't, thus the question: "Is sol_2 correct?"

Could you help me to fix this?
TIA

 > restart
 > infolevel[dsolve] := 4;
 (1)
 > sys_1 := {diff(x(t), t\$2)=sin(t)-x(t), x(0)=0, D(x)(0)=0}; sol_1 := dsolve(sys_1)
 Methods for second order ODEs: --- Trying classification methods --- trying a quadrature trying high order exact linear fully integrable trying differential order: 2; linear nonhomogeneous with symmetry [0,1] trying a double symmetry of the form [xi=0, eta=F(x)] -> Try solving first the homogeneous part of the ODE    checking if the LODE has constant coefficients    <- constant coefficients successful    -> Determining now a particular solution to the non-homogeneous ODE       building a particular solution using variation of parameters <- solving first the homogeneous part of the ODE successful
 (2)
 > sys_2 := {(M__p+M__a)*diff(x(t), t\$2)=M__p*sin(t)-x(t), x(0)=0, D(x)(0)=0}; sol_2 := dsolve(sys_2)
 Methods for second order ODEs: --- Trying classification methods --- trying a quadrature trying high order exact linear fully integrable trying differential order: 2; linear nonhomogeneous with symmetry [0,1] trying a double symmetry of the form [xi=0, eta=F(x)] -> Try solving first the homogeneous part of the ODE    checking if the LODE has constant coefficients    <- constant coefficients successful    -> Determining now a particular solution to the non-homogeneous ODE       building a particular solution using variation of parameters <- solving first the homogeneous part of the ODE successful
 (3)
 > eval(sol_2, [M__p=1, M__a=0])
 >

PS: Already, in the following case, dsolve doesn't return the solution of sys_1.

```sys_3 := {(A+B)*diff(x(t), t\$2)=(A+B)*sin(t)-x(t), x(0)=0, D(x)(0)=0};
sol_3 := dsolve(sys_3)
```

If I do this

```sys_4 := {(A+B)*diff(v(t), t)=(A+B)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_4 := dsolve(sys_4)
```

I get a very complex solution wich contains a piecewise function which separates the cases A+B=1 and A+B<>1.
Evaluating sol_4 for A+B=1 gives the same expression than sys_1:

```simplify(eval(sol_4, A=1-B), trig)
/       1                  1          1         \
{ v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
\       2                  2          2         /
```

Here is a workaround to get the correct solution of sys_2:

```sys_5 := {(M__P+M__A)*diff(v(t), t)=(M__P+C)*sin(t)-x(t), diff(x(t), t)=v(t), x(0)=0, v(0)=0}:
sol_5 := dsolve(sys_5):
simplify(eval(sol_5, [M__P=1, M__A=0, C=0]), trig)
/       1                  1          1         \
{ v(t) = - sin(t) t, x(t) = - sin(t) - - cos(t) t }
\       2                  2          2         /
```

e

## How can I get the desired answer from "s...

Maple 2015

I compute the solution of this differential system

```shock := piecewise(t <0, 0, t < 1, 10, 0):
sys   := {(M__p+M__a)*diff(x(t), t\$2)=M__p*shock-x(t), x(0)=0, D(x)(0)=0}
sol   := unapply(rhs(dsolve(sys)), (M__p,M__a))
```

I'm interested in 3 quantities:

• the first time tend > 0 such that sol(tend) = 0,
• the time tmax in (0..tend) where sol(tmax) reaches its maximum value,
• the value xmax = sol(tmax).

Since sol has a relatively simple expression, I first attempted to use solve for calculating tend, but that didn't work.
The conclusion is still the same for tmax and xmax.

The values of these 3 quantities that I expect solve to provide, are those obtained using fsolve.

Can you explain me the failures I faced and show me how to force solve to get these values?
TIA

ToyProblem.mw

## How to construct a multiple layered arro...

Maple

Given this "pattern" to transfporm an expression into an arrow procedure

```e := 1/b:
f := unapply(e, b):
f(3)
1
-
3
```

I would like now to use this same "pattern" to transform an expression e which depends on 2 indeterminates a and b into a "double layered arrow procedure" f.
Here is a notional example

```e := a/b:
f := unapply(unapply(e, b), a);
a
a -> b -> -
b

f(A)(B)
a
-
B
```

How can I proceed in order that f(A)(B) gives A/B ?

TIA

## evalf/Int issue with Maple 2020...

Maple 2020

Hi,

This chunk of code gives me almost instantly the desired result with Maple 2015 but fails returning a result after 5 minutes when ran from  Maple 2020.
Changing the method or trying to tune their options doesn't fix the issue (for a larger value of the absolute tolerance the result, close to 1, is even obviously false).

TIA

 > restart;
 > interface(version)
 (1)
 > with(Statistics):
 > Model_1 := (X, Y, Z) -> 1.3479120558270161+(-1)*.3390713110446567*X+1.0332964944900824*Y+(-1)*.8046331250569234*Z+0.9028899142595827e-1*X^2+(-1)*.28022910356641223*Y^2+1.3698461513469624*Z^2+0.6023630210658247e-1*Y*X+(-1)*.1988111077193626*Z*X+.6782902277463169*Z*Y+(-1)*0.7589729001497135e-1*X*Y*Z: Model_2 := (X, Y, Z) -> .7215754021067852-.961682838202105*X+.4890842364596477*Y-.8214961524335734*Z+.15745942215497866*X^2-1.8023544416693338*Y^2+.36598799463016246*Z^2+1.3957614823018496*Y*X+.725398415577742*Z*X+1.9474707393604542*Z*Y-1.1780201448596594*X*Y*Z: ExpMod_2 := unapply(expand(Model_2(Model_1(X1, Y1, Z1), Y2, Z2)), (X1, Y1, Z1, Y2, Z2)):
 > fy1 := PDF(Normal(0.1055, 0.0297), Y1): fz1 := PDF(Normal(1, 0.2/3), Z1): fy2 := PDF(Normal(0.17, 0.0476), Y2): fz2 := PDF(Normal(1, 0.2/3), Z2): C   := evalf(          (1-eval(CDF(Normal(0.1055, 0.0297), Y), Y=0))          *          (1-eval(CDF(Normal(0.17, 0.0476), Y), Y=0))          *          (eval(CDF(Normal(1, 0.2/3), Z), Z=1.2)-eval(CDF(Normal(1, 0.2/3), Z), Z=0.8))^2        ): J  := Int(         fy1*fz1*fy2*fz2*(1+tanh(10^4*(ExpMod_2(2.14, Y1, Z1, Y2, Z2)-1.25)))/2,         Y1=0..0.4,         Z1=0.8..1.2,         Y2=0..0.4817,         Z2=0.8..1.2,         method = _CubaDivonne, methodoptions=[absepsilon=1e-8]       ): Prob(X__2 > 1.25) = nprintf("%1.3e", evalf(J)/C);
 (2)
 >