# With Intel Xeon(R) E5-2667 v4 and 250GB RAM: still automatically quitting kernel when doing symbolic integrations

[![Here is the configuration for my calculation. Guess it can't be affected by this.][1]][1]

I was in trouble when solving the algebraic equations for q1 and q2. $$$$\label{eq:18} \begin{split} &\int_{0}^{1}(\phi_{m}(x))(\sum_{j=1}^{2}\phi''''_{j}(x){q}_{j}(t)){dx}\\&+{\alpha}V^2\sum_{i=0}^{9}p_{i}{h}^{i}\int_{0}^{1}(\phi_{m}(x))\sum_{j=1}^{2}(\phi_j(x)q_j(t))^i{dx}=0,\ m=1,2 \end{split}$$$$ The execution of my code was always interrupted when it comes to Static1 and Static2. Mathematica quit my kernel and gave no output. I sincerely hope if anyone can kindly help optimize it or give some hints when solving this equation with plain expression. Thanks in advance.

L = 500 10^-6; EE = 150 10^9; h = 2 10^-6;
b = 20 10^-6; h = 2 10^-6; II = b*h^3/12;
alpha = L^4/(EE*II* h);
p = {-1.12023 10^-7, -2.55082 10^-4, 4.622213 10^2, -2.12115 10^7,
3.994787 10^11, -2.80165 10^15, 0, 0, 0, 0};
k = {1.4590, 4.0701, 7.0685, 10.0879};
ratio = {0.7776, 1.0110, 0.9997, 1};
phi1[x_] =
Cosh[k[[1]]*x] - Cos[k[[1]]*x] -
ratio[[1]]*(Sinh[k[[1]]*x] - Sin[k[[1]]*x]);
phi2[x_] =
Cosh[k[[2]]*x] - Cos[k[[2]]*x] -
ratio[[2]]*(Sinh[k[[2]]*x] - Sin[k[[2]]*x]);

phi1tip = phi1[1];
phi2tip = phi2[1];

w[x_, t_] = phi1[x]*q1[t] + phi2[x]*q2[t];
Static1 =
Integrate[D[w[x, t], {x, 4}]*phi1[x], {x, 0, 1}] +
VDC^2*alpha*
Sum[p[[i + 1]]*h^i*Integrate[phi1[x]*w[x, t]^i, {x, 0, 1}], {i,
0, 5}] == 0;
Static2 =
Integrate[D[w[x, t], {x, 4}]*phi2[x], {x, 0, 1}] +
VDC^2*alpha*
Sum[p[[i + 1]]*h^i*Integrate[phi2[x]*w[x, t]^i, {x, 0, 1}], {i,
0, 5}] == 0;

qns = {Static1, Static2};
vars = {q1, q2};
eqn2 = eqns /. Thread[vars -> Through[vars[VDC]]];
ode = D[eqn2, VDC];
ip = Equal @@@ First@Nsolve[eqn2 /. VDC -> 0, Through[vars[0]], Reals];
{q1sol, q2sol} = NDSolveValue[Flatten@{ode, ip}, vars, {VDC, 0, 200}];
disp[t_] := (q1sol[t]*phi1tip + q2sol[t]*phi2tip)*h*1 10^6;
Plot[{disp[t]}, {t, 0, 200}, GridLines -> Automatic]
disp[Range[0, 200, 5]]

[1]: https://i.stack.imgur.com/fYEAx.png
[2]: https://i.stack.imgur.com/1bHdo.png


## 1 Answer

For evaluating Static1 and Static2 a bit of trigonometric expansion seems to help:

Static1 = Integrate[D[w[x, t], {x, 4}]*phi1[x], {x, 0, 1}] +
VDC^2*alpha*Sum[p[[i + 1]]*h^i*
Integrate[phi1[x]*w[x, t]^i // TrigToExp // Expand,
{x, 0, 1}], {i, 0, 5}] == 0 // Expand;

Static2 = Integrate[D[w[x, t], {x, 4}]*phi2[x], {x, 0, 1}] +
VDC^2*alpha*Sum[p[[i + 1]]*h^i*
Integrate[phi2[x]*w[x, t]^i // TrigToExp // Expand,
{x, 0, 1}], {i, 0, 5}] == 0 // Expand;


What follows these commands still needs some work.

For assembling the ODE you can do

eqns = {Static1, Static2};
vars[t_] = {q1[t], q2[t]};
eqn2 = eqns /. t -> VDC;
ode = D[eqn2, VDC];


The initial condition is insufficient and only show that you need to have $$q_1(0)=-q_2(0)$$:

ip = Solve[eqn2 /. VDC -> 0, vars[0]]


During evaluation of Solve::svars: Equations may not give solutions for all "solve" variables.

(*    {{q2[0] -> (-1. + 0. I) q1[0]}}    *)
`

Hope this gets you started.

• Wow! That's fantastic. I could not really think of using TrigToExp to help get a sum since I believed MMA could handle it. Now I understand the success comes from that my phi1 and phi2 both contain trigonometric terms and TrigToExp makes MMA find a clear way and calculate much more efficiently! Thank you a million Roman!
– Josh
Aug 22, 2021 at 15:54
• Yes, for some reason Mathematica finds it easier to integrate exponentials than convoluted trigonometrics, even though they are the same thing! Aug 22, 2021 at 16:06