plotting – Labeling of 2 equations plotted in 3D plot

I want to plot Subscript((Rho), i)

Subscript((Rho), i)=1/(1 + ((-Subscript(r, 1) + 10)/(-Subscript(r, 2) + 10))^(-1/2))

Subscript((Rho), j)=1/(1 + ((-Subscript(r, 2) + 10)/(-Subscript(r, 2) + 10))^(-1/2))

in 3D plot. I have used following code:

Plot3D({1/(1 + ((-Subscript(r, 1) + 10)/(-Subscript(r, 2) + 10))^(-1/2)), 1/(1 + ((-Subscript(r, 2) + 10)/(-Subscript(r, 2) + 10))^(-1/2))}, {Subscript(r, 1), 0, 9.99}, {Subscript(r, 2), 0, 9.99}, AxesLabel-> {"!(*SubscriptBox((r), (1)))", "!(*SubscriptBox((r), (2)))", "!(*SubscriptBox(((Rho)), (i)))", "!(*SubscriptBox(((Rho)), (j)))"})

But, I cannot label

Subscript((Rho), i) and Subscript((Rho), j)
Any instruction please

mathematical optimization – How can I minimize a target function that has to solve differential equations numerically?

My problem is to minimize a target function with differential equations in it.

The target function is

$$min mathrm{J}left( p right) =sum_{i=1}^5{|x_ileft( p right) -y_i|},$$

where $x_i(p)$ are differential equations like this:

stateFunctionV(v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_) := 
  {μ = 
    (67/100)(x2(t)/(x2(t) + 28/100))(1 - x3(t)/940)(1 - x4(t)/1050)^3 (1 - x5(t)/361);
   x1'(t) == μ*x1(t),
   x2'(t) == -(v1 + μ/v5)* x1(t),
   x3'(t) == (v2 + μ*v6)*x1(t),
   x4'(t) == (v3 + μ*v7)* x1(t),
   x5'(t) == (v4 + μ*v8)* x1(t),
   x1(0) == 0.2025, x2(0) == 441.337, x3(0) == 0, x4(0) == 0, x5(0) == 0}

and $y_i$ is the experiment data.

The code:

PIP1(value_) := 
  {Sum(
     Sum(
       Abs(
         NDSolveValue({
           μ = (67/100)(x2(t)/(x2(t) + 28/100))(1 - x3(t)/940)(1 -       x4(t)/1050)^3(1 - x5(t)/361); 
           x1'(t) == μ*x1(t), 
           x2'(t) == -(value((1)) + μ/value((5)))x1(t),
           x3'(t) == (value((2)) + μ value((6)))x1(t),
           x4'(t) == (value((3)) + μ value((7)))x1(t),
           x5'(t) == (value((4)) + μ value((8)))x1(t),
           x1(0) == 0.2025, x2(0) == 441.337, x3(0) == 0, x4(0) == 0, 
           x5(0) == 0}, {x1, x2, x3, x4, x5}, {t, 0, 6.5})((i))(data2((i, j, 1))) - data2((i, j, 2))), 
       {j, 1, 7}), 
     {i, 1, 5})}

NMinimize(PIP1({v1, v2, v3, v4, v5, v6, v7, v8}), {v1, v2, v3, v4, v5, v6, v7, v8})

doesn’t work. I also tried to take the differential functions out as a new function and it also failed.

So I wonder if there’s a way to minimize this problem with NMinimize or not? I would be grateful for your advice on how to couple NMinimize and NDSolveValue.

The experiment data are below:

data2 = 
  {{{0, 0.2025}, {2, 0.76}, {3, 1.28}, {4, 2.2}, {5, 2.75}, {6, 2.95}, {6.5, 3.055}}, 
   {{0, 441.337}, {2, 400.435}, {3, 300.326}, {4, 219.348}, {5, 120.109}, {6, 50}, {6.5, 25}}, 
   {{0, 0}, {2, 42.2895}, {3, 78.6579}, {4, 117.026}, {5, 152.158}, {6, 229.553}, {6.5, 224.1205}}, 
   {{0, 0}, {2, 1.66667}, {3, 13.55}, {4, 16.6667}, {5, 22.7333}, {6, 34.4333}, {6.5, 71.2333}}, 
   {{0, 0}, {2, 6.73913}, {3, 7.86957}, {4, 9.3913}, {5, 8.34783}, {6, 10.9565}, {6.5, 11.8261}}};

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)).

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<x<pi$ and $0<y<1$

$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
s.t. gradient(h(0,0))=0

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:
enter image description here

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:

enter image description here

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}})

enter image description here

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}}); 

enter image description here

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)}

enter image description here

But when I try to solve the Equation,

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

enter image description here

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..

enter image description here

Please help me to solve the problem.