## differential equations – Search for roots in numerical solution of CoSODE

Is there a way to find out the roots of the system numerically?

For the toy model described by the coupled second order differential equation (CoSODE),

$$addot{x}-cy=0$$

$$addot{y}-cx=0$$

the solution is,

$$x(t)=Ae^{iwt}$$

$$y(t)=Be^{iwt}.$$

Substituting the solutions back into the differential equations and simplifying yields

$$-aw^2=cfrac{B}{A}$$

$$-aw^2=cfrac{A}{B}$$

and multiplying the above together yields,

$$F(w) = (aw^2)^2-c^2.$$

Solving for roots when F(w) = 0 yields,

$$pmsqrt{(c/a)}$$

The above is a simple problem enough to allow us to solve it analytically and use it to find (possible complex) roots of F(w). Can the above be done to find roots of F(w) numerically with one undefined parameter say $$a$$ is unknown? The reason I am asking is that some CoSODE are more complicated and nonlinear hence finding the solution of the differential equation analytically/symbolically is impossible. Furthermore, the determinant cannot be employed in complicated case because of nonlinear terms. (Note that I do not have access to the latest version of mathematica (12)).

## numerical integration – How add noise to a differential equation?

I have a differential equation:

$$frac{dx}{dt}=sech(x-1)$$

I want to add noise to it and try to solve it numerically, but it seems that I am programming something wrong, because there is no noise. I am trying to do this by adding a random number.

``````ClearAll("Global`*")

pars = {(Alpha) = 1, (Beta) = 1/20, (Gamma) = 1,
h = 1, (Omega) = 2 Pi 1/2, (Mu) = 1, xs = -1, xe = 1}

f = Sech(x(t) - xe)

sys = NDSolve({x'(t) ==
ArcTan(1 D(f, x(t))) + RandomReal({-1/10, 1/10}),
x(0) == xs}, {x}, {t, 0, 500})

Plot({Evaluate(x(t) /. sys), xe}, {t, 0, 10}, PlotRange -> All,
PlotPoints -> 40)
``````

## differential equations – How to impose initial condition for a duration of time?

A variable in my coupled pde system, $$X1(t,x)$$, has a piecewice initial condition for a duration.

$$X1(t,x)$$ in a rectangular region between (-20,+20) is raised to 10 gram for 6 seconds”

I don’t have a problem with it’s “piecewiseness” (“$$X1(t,x)$$ in a rectangular region between (-20,+20) is raised to 10 gram”, which I express as `X1(0,x)==If(-20<x<20,10,5)`).

But I don’t know how can I write an initial condition saying “$$X1(t,x)$$ in a rectangular region between (-20,+20) is raised to 10 gram for 6 seconds“.

I tried to add it as an additional initial condition but it didn’t worked. Do you have any idea?

## matlab – Is there any way to obtain linearized state space model from set of differential equations in SIMULINK?

I should linearize my model around points. It seems that linmod function can linearize the system, but to run this code, we have a plant in SIMULINK. I don’t have a plant in SIMULNK, but i have 15 differential equations of my model.

Is there any toolbox to linearize my nonlinear state space?

Thanks a lot,

EDIT: In my opinion, i should implement my diff. eqs. in SIMULINK and use blocks. After that, using of linmod will be effective for my operation.

## partial differential equations – Show that eigenvalues and eigenvectors of the correspponding Sturm-Liouville

$$u_{xx}+u_{yy}=frac{xy^{2}}{2}$$ $$0 and $$0

$$u_{x}(0,y)=0$$ , $$u_{x}(pi,y)=0$$ , $$0leq yleq 1$$ ………………..(1)

$$u(x,0)=sin(x)$$ , $$u(x,1)=2x+1$$ , $$0leq xleq pi$$

Show that eigenvalues and eigenvectors of the correspponding Sturm-Liouville problem are;

$$lambda _{n}=n^{2},X_{n}(x)=cos(nx),n=1,2,3…$$

Find the solution of the problem (1)?

I can solution of he problem but i couldnt evaluate eigenvalues eigenvectors…

## differential equations – Error on DSolve

I’ve been trying to solve this initial value problem using ‘DSolve()’:

$$frac{dy}{dt}=1+tspace sin(tspace y),quad y(0)=0, quad t=(0,2)$$

``````ClearAll(y, t)
eq1 := {y'(t) == 1 + t *Sin(t y(t)), y(0) == 0};
DSolve(eq1, y(t), {t, 0, 2})
``````

All I get is the Inverse function error.

``````
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

``````

The documentation suggests it has to do with the sine function but I’m not sure how to by-pass it.

Any help would be appreciated.

## differential equations – Numerically solve PDEs with constraints and without boundary solution

I have a PDE like

``````D(h(x1, x2), x1)*f(x1, x2)+D(h(x1, x2), x2)*g(x1, x2) == h(x1,x2)
f(x1, x2) = x2
g(x1, x2) = Sin(x1)+x2
``````

This PDE doesn’t have an analytical solution, but since I don’t have a boundary condition, how can I find some feasible solutions that can satisfy the gradient constraint?

## differential equations – How to solve this problem similar to eigenvalue problem but with sources?

I have two coupled differential equations with this structure:

$$f_1(r)partial_r^2h_{00}(r)+f_2(r)partial_rh_{00}(r)+f_3(r)partial_rh_{22}(r)+(omega^2+V_1(r))h_{00}(r)+(omega^2+V_2(r))h_{22}(r)=S_1(r)$$
$$g_1(r)partial_r^2h_{22}(r)+g_2(r)partial_rh_{22}(r)+(omega^2+V_3(r))h_{22}(r)=S_2(r)$$
where all the functions $$f_i(r),g_i(r),V_i(r)$$ and $$S_j(r)$$ are known (and non linear). I have to solve for the parameter $$omega$$ and for the functions $$h_{00}(r)$$, $$h_{22}(r)$$. The boundary conditions are that the functions are bounded in the origin and fall off as $$r^{-n}$$ at infinity.

Without the sources, this is an eigenvalue problem, but I have sources: how do I treat this kind of problem?

For definiteness consider a system of the form:

``````r^-2 D(h00(r),{r,2}) + r^-3 D(h00(r),r) + r D(h22(r),r) + (w^2 + r^-2)h00(r) + (w^2 + 2 r^-2)h22(r) == Exp(-r)
D(h22(r),{r,2}) + r^-1 D(h22(r),r) + D(h00(r),r) + (w^2 + r^-3) h22 ==  r^2 Exp(-r)
``````

## differential equations – Infinity: Indeterminate expression 0.0389874+Complexinfinity+Complexinfinity encountered

I’d like to solve 2nd order differential equation:

Which I’d like to draw a graph of x_M and h. m, g, and M is a real constant. Cd is well defined function that has a parameter as x_M’
theta is piecewise defined function,
that appears as below:

for this equation, I used code :

``````(Theta)0 = 0.5236;
(Omega)1 = 5.2359877;
(Omega)2 = 1.396;
t1 = (Theta)0 / (Omega)1;
t2 = (Theta)0 / (Omega)2;
T=2*(t1+t2);
f(t_)=Piecewise({{ -Mod(t,T)*(Omega)1 ,0<=Mod(t,T)<t1},{ -(Theta)0+((Mod(t,T)-t1)*(Omega)2), t1<=Mod(t,T)<(t1+2t2)},{(Theta)0-((Mod(t,T)-t1-2t2)*(Omega)1),(t1+2t2)<=Mod(t,T)<T}})
``````

It is clear that derivative of the function is

``````thetaprime(t_):=Piecewise({{-5.2359877 ,0<=Mod(t,T)<t1},{ 1.396, t1<=Mod(t,T)<(t1+2t2)},{-5.2359877,(t1+2t2)<=Mod(t,T)<=T}});
``````

for differential equation, I used a code

``````initconds = {x(0) == 0, x'(0) == 0.00001, h(0) == (M + m)/((Rho)*A), h'(0) == 0}
eqns = {m Cos((Theta)(t)) Sin((Theta)(t)) h''(t) + (M + m (Sin((Theta)(t))^2)) x''(t) == - Cd(Derivative(1)(x)(t)) *h(t)* Derivative(1)(x)(t) + m Sin((Theta)(t)) (g Cos((Theta)(t)) + r thetaprime(t)^2),( -M-(m*Cos((Theta)(t))^2))*h''(t) - m Cos((Theta)(t)) Sin((Theta)(t)) x''(t) == -g M + A g (Rho) h(t) - m Cos((Theta)(t)) (g Cos((Theta)(t)) + r thetaprime(t)^2)}
``````

But when I try to solve the Equation,

``````sol = NDSolve(Append(eqns, initconds), {x, h}, {t, 0, tf}, Method -> {"DiscontinuityProcessing" -> False})
``````

It gives following three errors. I can’t understand why these errors occur.

Infinity::indet: Indeterminate expression 0.0389874 +ComplexInfinity+ComplexInfinity encountered.

Infinity::indet: Indeterminate expression -0.160636+ComplexInfinity+ComplexInfinity+ComplexInfinity+ComplexInfinity+ComplexInfinity encountered.

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0..

In solving a large system of ODEs I found that `Method->ExplicitRungeKutta` (also `Automatic` as a matter of fact) is fast, but often unstable. I tried the option `Method->ImplicitRungeKutta`, but for the given number of ODEs (3924) the memory used by the kernel grows above 50GB. Eventually I have to stop the calculation. What options of `NDSolve` can be tried to improve the stability and remain with reasonable memory consumption?