differential equations – How to define the Laplacian type operator in Mathematica?

I have the following Laplacian type operator, mathematically, this is as follows.$$e^{2y} (partial_{x})^2 + (partial_{y})^2 – partial_{y}$$.

Now I want will consider an eigenvalue problem (with the Dirichlet boundary condition) on a unit square as follows.

$$Lu = lambda u$$ where $$L = (partial_{x})^2 + (partial_{y})^2 – partial_{y}$$

Now I want to know how to define $L$ defined as above in Mathematica?

Please help me.

Thanking in advanced.

differential geometry – Computing the surface area 2-form for a paraboloid

Suppose I want to find a 2-form in ${bf R}^3$ which gives the surface area to the paraboloid $D$ in some bounded region,

$$phi(s,t)=(s,t,s^2+t^2)$$

I know that a general 2-form in ${bf R}^3$ has the form,

$$omega=f_1dxwedge dy + f_2dywedge dz+f_3dxwedge dz$$

Then this becomes,

$$int_Domega=int_{phi^{-1}(D)}Big(f_1(phi(s,t))-f_2(phi(s,t))2s+f_3(phi(s,t))2tBig)dswedge dt$$
$$$$

If $J$ is the Jacobian for $phi$, then since I know that the surface area element is given by $sqrt{det(J^TJ)}=sqrt{1+4s^2+4t^2}$, then that means one possible solution would be,

$$f_1=f_2=f_3=frac{sqrt{1+4x^2+4y^2}}{1-2x+2y}$$

More generally, for surfaces in ${bf R}^3$, it seems like one can always determine a (the?) surface area 2-form by computing,

$$f_1=f_2=f_3=frac{sqrt{(det J_{xy})^2 + (det J_{yz})^2 + (det J_{xz})^2}}{det J_{xy} + det J_{yz} + det J_{xz}}circphi^{-1}$$

Clearly any time a parametrization can be formed by simply projecting down onto the xy-plane, computing this is trivial, however I imagine that computing $phi^{-1}$ in general may be intractable. Nevertheless, $phi$ is injective, so should it not always exist in theory?

Moreover, what exactly is this object? When can it be computed? does it always in theory exist? And is this generalizable to any dimension.

differential equations – Piecewise PDE Over 3 Regions with Continuity Boundary Conditions

I am using Wolfram Language for the first time for my research and could really use some help! I am trying to find the analytical solution of a PDE which has piecewise constants and a piecewise input.

The PDE is to model the lithium-ion concentration in an electrolyte solution of a battery (in 1-dimension, x), and it has three regions, the Cathode, Separator, and Anode. This plot is an example to show these regions and the concentration gradient that the PDE is predicting:

enter image description here

(Ignore that the plot and axis above the plot don’t line up perfectly, it’s what I had available)

So with that background, this is the PDE:

enter image description here

Which in code I have as:

pde={-(yi  J(s)/(A Li ai)) + s ce(x,s) - De * D(ce(x,s),{x,2}) == 0}

With the general analytical solution found by:

pdesoln=DSolve(pde,ce,{x,s})

But Li and ai have different constant values in the Anode vs. the Cathode region. Also important, I(s)=0 in the separator region. So I tried to tackle this as 3 separate PDEs rather than a single piecewise PDE, with the intention of stitching the PDEs together at the end based on their boundary conditions. (So 1 PDE for the anode region, 1 for the separtor, and 1 for the cathode). The boundary conditions of the PDEs are:

enter image description here

Essentially there’s 1 Neumann and 1 Dirichlet B.C. at each interior boundary, and 1 Neumann B.C. at each end of the battery cell. The problem I’m really running into is that the interior B.C.’s are all based off the solutions of the other PDEs, and I don’t know how to stitch them together.

I think I’ve imposed the exterior Neumann B.C.’s correctly…

Anode:

pdeanode={-(yn  J/(A Ln an)) + s ceanode(x,s) - De * D(ceanode(x,s),{x,2}) == 0}
icanode = {Derivative(1,0)(ceanode)(0,s) ==0};
pdeanodesoln=DSolve({pdeanode,icanode},ceanode,{x,s})
pdeanode/.pdeanodesoln((1)) //Simplify

Cathode:

pdecathode={-(yp  J/(A Lp ap)) + s cecathode(x,s) - De * D(cecathode(x,s),{x,2}) == 0}
iccathode = {Derivative(1,0)(cecathode)(Lc,s) ==0};
pdecathodesoln=DSolve({pdecathode,iccathode},cecathode,{x,s})
pdecathode/.pdecathodesoln((1)) //Simplify

Note: J used in place of I(s) becuase I is interpreted as an imaginary number

And I defined the Separator region PDE as this, given I(s)=0 in the separator:

pdesep={s cesep(x,s) - De * D(cesep(x,s),{x,2}) == 0}
pdesepsoln=DSolve(pdesep,cesep,{x,s})
pdesep/.pdesepsoln((1)) //Simplify

But I am not able to impose any boundary conditions to this atm. Or more accurately, I don’t know how to stitch these 3 PDEs together. Can somebody help me out? It’d be greatly appreciated!

differential equations – Eigenvalues not exceeding a given number

I am computing the eigenvalues of Laplacian numerically.

Consider the eigenvalue problem on $Omega = [0 , 1]^2$

$$-Lu = lambda u$$ where $$L = frac{partial^2}{partial x^2} + frac{partial^2}{partial y^2}$$ and The Dirichlet’s boundary condition is $u = 0$ on $partial Omega$.

I am able to calculate the first $100$ eigenvalues of this Laplacian problem as follows:

{ℒ, ℬ} = {-Laplacian[u[x, y], {x, y}],
DirichletCondition[u[x, y] == 0, True]};

{vals, funs} = 
DEigensystem[{ℒ, ℬ}, 
u[x, y], {x, 0, 1}, {y, 0, 1},100];

vals

But I am facing difficulties in making list of eigenvalues for a given number such that eigenvalues don’t exceed that given number. Also, I want know that Length[expr] gives the number of elements in “expr”. But I have no idea how to use Length[expr] after making list of eigenvalues not exceeding the given number, that is, I want to calculate the number of eigenvalues in the list after making the list of eigenvalues not exceeding the given number.

$textbf{QUESTION:}$ How to make a list of eigenvalues of the Laplacian till a given number. For example, if we are given a number $80$ then the eigenvalues are ${19.7392 , 49.348 , 49.348 , 78.9568}$. Now take the number $400$, I want to list of eigenvalues not exceeding $400$ and I want to find the number of eigenvalues in the list.

Please help me. Thanking in advanced.

warning messages – Some of the functions have zero differential order

I am trying to solve the following system of differential equations, but Mathematica (11.3) complains that

NDSolveValue::pdord Some of the functions have zero differential order

I do not understand this message since all of the functions appear with their derivatives in the equations.

Here is the code:

ClearAll("Global`*")
(Rho)0 = 1;
M = 1;
eq1 = D(m(t, r), r) - 4 Pi (Rho)(t, r) R(t, r)^2 D(R(t, r), r);
eq2 = D(m(t, r), t) + (4 Pi)/3 (Rho)(t, r) R(t, r)^2 D(R(t, r), t);
eq3 = D(R(t, r), r, t) - D(R(t, r), t) D((Nu)(t, r), r) - 
   D(R(t, r), r) D((Lambda)(t, r), t);
eq4 = D((Rho)(t, r), r) + 1/4 (Rho)(t, r) D((Nu)(t, r), r);
eq5 = Exp(-2 (Nu)(t, r)) (D(R(t, r), {t, 2}) - 
      D((Nu)(t, r), t) D(R(t, r), t)) - 
   Exp(-2 (Lambda)(t, r)) D((Nu)(t, r), r) D(R(t, r), r) + m(t, r)/
   R(t, r)^2 + (4 Pi)/3 (Rho)(t, r) R(t, r);
{Ro, Ra, Ma, nu, la} = 
 NDSolveValue({eq1 == 0, eq2 == 0, eq3 == 0, eq4 == 0, 
   eq5 == 0, (Rho)(0, r) == (Rho)0, (Rho)(t, 0) == (Rho)0, 
   m(0, r) == M, 
   m(t, 0) == 
    M, (Nu)(0, r) == -(1/4) Log((Rho)0), (Nu)(t, 
     0) == -(1/4) Log((Rho)0), (Lambda)(0, r) == 
    0, (Lambda)(t, 0) == 0, R(0, r) == ((3 M)/(4 Pi (Rho)0))^(1/3), 
   R(t, 0) == ((3 M)/(4 Pi (Rho)0))^(1/3), 
   Derivative(1, 0)(R)(0, r) == 1}, {(Rho), R, 
   m, (Nu), (Lambda)}, {t, 0, 1}, {r, 0, 1})

Note: another message appears saying that the initial and boundary conditions are inconsistent, but that is another problem I have to solve later, I am more concerned with the other message at the moment.

DAE solver fails for system of coupled partial differential equations

I am trying to run the following code to solve a system of coupled differential equation:

ClearAll("Global`*")
(Rho)0 = 1;
M = 1;
eq1 = D((Rho)(r, t), t) R(r, t) D(R(r, t), r) + 
   1/3 D((Rho)(r, t), r) R(r, t) D(R(r, t), t) + 
   10/3  (Rho)(r, t) D(R(r, t), r) + 
   4/3 (Rho)(r, t) R(r, t) D(R(r, t), r, t);
eq2 = Simplify(
   D(R(r, t), r, t) + 
    D(R(r, t), 
      r) (3/2 D((Rho)(r, t), t)/(Rho)(r, t) - 
       4 D(R(r, t), t)/R(r, t)) + 
    D(R(r, t), t) D((Rho)(r, t), r)/(4 (Rho)(r, t)));
{Ro, Ra} = 
 NDSolveValue({eq1 == 0, 
   eq2 == 0, (Rho)(r, 0) == (Rho)0, (Rho)(0, t) == (Rho)0, 
   R(r, 0) == ((3 M)/(4 Pi (Rho)0))^(1/3), 
   R(0, t) == ((3 M)/(4 Pi (Rho)0))^(1/3)}, {(Rho), R}, {r, 0, 
   1}, {t, 0, 1})

but I get the error:

The DAE solver failed at r = 0.`. The solver is intended for index 1
DAE systems and structural analysis indicates that the DAE is
structurally singular

I tried to read this page on DAE, but I did not understand most of it. How can I solve my system?

differential equations – Replicating off-the-shelf ODE solvers

I’ve been working through some literature on ODEs and keep coming across the below pseudo-code expression and am having trouble interpreting it for use in the Wolfram Language. I feel like I’ve solved many initial value problems over the years with NDSolve, but now think I need some help from someone who works with ODEs in a more robust capacity to describe the differences.

The above is from here which states that h(t0) is the initial state of the system, G is the function that defines the system. t0 & t1 are the start and end times and Theta is the parameters. (Pytorch also has an implementation I’ve been looking at).

As I researched ways to understand the parameters, I kept coming up with pseudo-code examples using ODESolve. Should I be using a different MMA function? Maybe there is an option I’m not understanding? What’s the most straightforward way to think about this pseudo-code example in Mathematica?

differential equations – Solving a nonlinear dynamical system using NDSole

You did not specify value for b. so I made one up.

ClearAll(x,y,t);
a=-1;b=2;
ode1=x'(t)==a*Cos(x(t))+2*y(t)+b*Sin(x(t));
ode2=y'(t)==(a*(Cos(x(t))+Cos(x(t)+y(t)))+b*(2*Sin(x(t))+y(t)))/Sin(y(t));
ic={x(0)==0,y(0)==0.1*10^(-3)};
sol=NDSolve({ode1,ode2,ic},{x,y},{t,0,1},
        Method->"StiffnessSwitching",AccuracyGoal->5,PrecisionGoal->4)

Mathematica graphics

Plot(Evaluate(x(t) /. sol), {t, 0, 1}, PlotRange -> All)

Mathematica graphics

Plot(Evaluate(y(t) /. sol), {t, 0, 1}, PlotRange -> All)

Mathematica graphics

it is stiff system.

differential calculus – Limiting normal cone of a non-convex subset

Let $C = {x in mathbb{R}^d colon |x|_infty leq 1 ; text{and} |x|_2 geq c}$ where $0 < c < 1$. I want to prove that for any $x in C setminus {-1, 1}^d$ the limiting normal cone is the singleton {0}, the zero vector. If $C$ was convex, this result follows immediately by definition of the normal cone over a convex set. Since $C$ is non-convex, however, this seems more difficult.

I tried a proof by contradiction but this does not seem to get me anywhere.

$$text{Regular normal cone}: widehat{mathcal{N}}_C(w) :={u in mathbb{R}^d colon limsup_{w’ stackrel{C}{to} w} tfrac{u cdot (w’ – w)}{|w’ – w|} leq 0}.$$

$$text{Limiting normal cone}: widehat{mathcal{N}}(w) := {u in mathbb{R}^d colon exists (w_k)_{k geq 0} stackrel{C}{to} w, (u_k)_{k geq 0} to u colon u_k in widehat{mathcal{N}}_C(w_k) forall k }. $$

differential equations – For the same code, Why NDSolve sometimes works good and sometimes doesn’t?

My code is given below

T1(n_, m_) := NIntegrate((-Log(t)^(m - 1))*(LaguerreL(n, m, -Log(t)))^2, {t, 0, 1}); T1(0, 0)

T2(n_, m_) :=NIntegrate((-Log(t)^(m - 1))*(LaguerreL(n - 1, m, -Log(t)))^2, {t, 0, 1}); T2(0, 0)

T3(n_, m_) :=NIntegrate((-Log(t)^(m - 1))*LaguerreL(n, m, -Log(t))*LaguerreL(n - 1, m, -Log(t)), {t, 0,1}); T3(0, 0)

T4(n_, m_, B_, z_) := NIntegrate((-Log(t))^(2*m)*t*(LaguerreL(n, m, -Log(t)))^3*Exp(-B/(f0(z))^2*(-Log(t))^m*t*(LaguerreL(n, m, -Log(t)))^2)*((m + 2*n)*LaguerreL(n, m, -Log(t)) + Log(t)* LaguerreL(n, m, -Log(t)) - 2*(m + n)* LaguerreL(n - 1, m, -Log(t))), {t, 0, 1}); T4(0, 0, 0.7, z)

s(n_, m_, B_, W_, z_) := NDSolve({f0''(z) + 1/f0(z)*(f0'(z))^2 == Factorial(n)/(Factorial(n + m)*(2*n + m + 1))*1/(f0(z))^3*(Factorial(n + m)/ Factorial(n)*(-2*n - m + 1) + (2*n + m)^2*T1(n, m) + 4*(m + n)^2*T2(n, m) - 4*(m + n)*(m + 2*n) T3(n, m) + B*W^2*T4(n, m, B, z)), f0(0) == 1, f0'(0) == 0},f0, {z, 0, 20}); a(z_) = s(0, 0, 0.7, 4, z)

T1, T2, T3, T4 are the integrals to be used in the NDSolve s(n,m,B,W,z).

F0(n_, m_, B_, W_, z_) = Evaluate(f0(z) /. a(z))

F0 is the solution of NDsolve s(n,m,B,W,z) for the arguments given by a(z)

S(wp_, L_) := 1/2*Sqrt((Pi)/8)*wp/L^3*Exp(-1/(2*L^2) - 3/2); S(0.885*10^15, 0.4)

ki(wp_, L_, w_, k_, c_) := (S(wp, L)*w)/(k*(0.1)^2*c^2); ki(1.77*10^15, 0.4, 0.531*10^15, 1.18*10^7, 3*10^8)

S4(n_, m_, B_, W_, r_, b_, z_) := NIntegrate(t^((r^2*(F0(n, m, B, W, z))^2)/(b^2*(f(z))^2))*((r^2*(F0(n, m, B, W, z))^2)/(b^2*(f(z))^2))^m*(-Log(t))^ 2*m)*(LaguerreL(n,m, -((r^2*(F0(n, m, B, W, z))^2)/(b^2*(f(z))^2))*Log(t)))^2*LaguerreL(n, m, -Log(t))*Exp(-B/(F0(m, n, B, W, z))^2*(-Log(t))^m*t*(LaguerreL(n, m, -Log(t)))^2)*(2* (m + 2*n)*LaguerreL(n, m, -Log(t)) + 2*Log(t)*LaguerreL(n, m, -Log(t)) - 4*(m + n)*LaguerreL(n - 1, m, -Log(t))), {t, 0, 1}); S4(0, 0, 0.7, 4, 1.3*10^-6, 3*10^-6, z)

ss is another NDSolve that used the value of integral S4 and the solution of the first NDSolve.

ss(n_, m_, B_, W_, r_, b_, k0_, k_, wp_, w_, L_, c_, z_) := NDSolve({f''(z) + 1/f(z)*(f'(z))^2 == (Factorial(n)/(Factorial(n + m)*(2*n + m + 1))*1/(f(z))^3*(r^4*k0^2)/(b^4*k^2))*(Factorial(n + m)/Factorial(n)*(-2*n - m + 1) + T1(n, m)*(2*n + m)^2 + 4*T2(n, m)*(m + n)^2 -4*T3(n, m)*(m + n)*(m + 2*n) + (B*W^2)/2*1/((0.1^2)*3)*Exp(-2*ki(wp, w, L, k, c)*z*k0*r^2)*S4(n, m, B, W, r, b, z)) + ((2*(S(w, L))^2*w^2*Exp(-2*ki(wp, w, L, k, c)*z*k0*r^2))/((0.1)^4*c^4*3^2))*(r^4*k0^2)/k^2*(f(z)), f(0) == 1, f'(0) == 0},f{z, 0, 3.0}); aa(z_) = ss(0, 0, 0.7, 4, 1.3*10^(-6), 3*10^(-6), 0.59*10^7,1.18*10^7, 0.885*10^15, 0.531*10^15, 0.4, 3*(10^8), z) // Quiet

Plot(Evaluate(f(z) /. aa(z)), {z, 0, 3})

For the same code sometimes I get the final plot and sometimes getting errors. I tried it many times. Why it happens.