differential equations – There are some warnings thrown with NDSolve here. How can I change my code to avoid them?

I want to solve some differential equations, but the warnings “NDSolve change the value” are thrown. How do I change the equations?
Are there some equations that are not allowed? Are some equations wrong?

Clear("`*")
n = 10;
a = CirclePoints(n);
b = 0.1;
equ = Flatten(
   Append(Table({Sqrt(
       Subscript(y, k - 1)'(t)^2 + Subscript(x, k - 1)'(t)^2) == 
       b, (Subscript(y, k)(t) - Subscript(y, k - 1)(t))*
        D(Subscript(x, k - 1)(t), 
         t) == (Subscript(x, k)(t) - Subscript(x, k - 1)(t))*
        D(Subscript(y, k - 1)(t), t), 
      Subscript(y, k - 1)(0) == a((k - 1, 2)), 
      Subscript(x, k - 1)(0) == a((k - 1, 1)), 
      Subscript(y, k - 1)'(0) == b*Normalize(a((k)) - a((k - 1)))((2))
      , Subscript(x, k - 1)'(0) == 
       b*b*Normalize(a((k)) - a((k - 1)))((1))
      }, {k, 2, 
      n}), {(Subscript(y, 1)(t) - Subscript(y, n)(t))*
       D(Subscript(x, n)(t), 
        t) == (Subscript(x, 1)(t) - Subscript(x, n)(t))*
       D(Subscript(y, n)(t), t), Subscript(y, n)(0) == a((n, 2)), 
     Subscript(x, n)(0) == a((n, 1)), 
     Sqrt(Subscript(y, n)'(t)^2 + Subscript(x, n)'(t)^2) == b, 
     Subscript(y, n)'(0) == b*Cos((Pi)/n), 
     Subscript(x, n)'(0) == b*Sin((Pi)/n)}), 2);

sol = NDSolve(equ, 
   Flatten({Subscript(x, #)(t), Subscript(y, #)(t)} & /@ Range@n, 
    2), {t, 0, 30}, MaxSteps -> 2000, SolveDelayed -> True);
result = Flatten({Subscript(x, #)(t), Subscript(y, #)(t)} & /@ 
    Range@n, 2);
result = Partition(result /. sol((1)), 2);

ParametricPlot(result, {t, 0, 30}, PlotTheme -> "Scientific", 
 PlotLabel -> "Bugs' movation", FrameLabel -> {"x", "y"})

differential equations – Theere is some warnings with NDSolve, So how can I write?

I want to Solve a differential equations, But there is some warnings “NDSolve change the value”, How to change the equations?
Is there some equations are illegal? Some equations are wrong?

Clear("`*")
n = 10;
a = CirclePoints(n);
b = 0.1;
equ = Flatten(
   Append(Table({Sqrt(
       Subscript(y, k - 1)'(t)^2 + Subscript(x, k - 1)'(t)^2) == 
       b, (Subscript(y, k)(t) - Subscript(y, k - 1)(t))*
        D(Subscript(x, k - 1)(t), 
         t) == (Subscript(x, k)(t) - Subscript(x, k - 1)(t))*
        D(Subscript(y, k - 1)(t), t), 
      Subscript(y, k - 1)(0) == a((k - 1, 2)), 
      Subscript(x, k - 1)(0) == a((k - 1, 1)), 
      Subscript(y, k - 1)'(0) == b*Normalize(a((k)) - a((k - 1)))((2))
      , Subscript(x, k - 1)'(0) == 
       b*b*Normalize(a((k)) - a((k - 1)))((1))
      }, {k, 2, 
      n}), {(Subscript(y, 1)(t) - Subscript(y, n)(t))*
       D(Subscript(x, n)(t), 
        t) == (Subscript(x, 1)(t) - Subscript(x, n)(t))*
       D(Subscript(y, n)(t), t), Subscript(y, n)(0) == a((n, 2)), 
     Subscript(x, n)(0) == a((n, 1)), 
     Sqrt(Subscript(y, n)'(t)^2 + Subscript(x, n)'(t)^2) == b, 
     Subscript(y, n)'(0) == b*Cos((Pi)/n), 
     Subscript(x, n)'(0) == b*Sin((Pi)/n)}), 2);

sol = NDSolve(equ, 
   Flatten({Subscript(x, #)(t), Subscript(y, #)(t)} & /@ Range@n, 
    2), {t, 0, 30}, MaxSteps -> 2000, SolveDelayed -> True);
result = Flatten({Subscript(x, #)(t), Subscript(y, #)(t)} & /@ 
    Range@n, 2);
result = Partition(result /. sol((1)), 2);

ParametricPlot(result, {t, 0, 30}, PlotTheme -> "Scientific", 
 PlotLabel -> "Bugs' movation", FrameLabel -> {"x", "y"})

Can I used NDsolve to solve Nonlinear Schroedinger Equation?

I am trying to used NDsolve to solve Nonlinear Schroedinger Equation:

 NDSolve[{I D[u[x, t], t] == -0.5*D[u[x, t], x, x] + 0.5*x^2*u[x, t] + 
 Abs[u[x, t]]^2 u[x, t], u[x, 0] == Exp[I*x]}, u, {t, 0, 2}, {x, 0,
 2}]

The above step is not working, I need to get the value of u may be real and imaginary and plot3D for both.

Thanks

Solving Fokker Planck Equation for steady state solution using NDSolve

I am trying to solve the FPE (Equation (4) in paper) for the steady state solution to reproduce Fig 2(b)&(c) in mathematica using ND Solve. The functions and parameter values I used are as described in the methods section of the paper

https://home.gwu.edu/~glan/files/2012.Nature.Physics%20-%20The%20energy%A8Cspeed%A8Caccuracy%20trade-off%20in%20sensory%20adaptation.All.pdf

The set of equations are:

$ 0 = -partial_mJ_m(a,m)- partial_aJ_a(a,m) $

$ J_m(a,m) = F_mP(a,m) – Delta_mpartial_mP(a,m) $
$ J_a(a,m) = F_aP(a,m) – Delta_apartial_aP(a,m) $

$ F_a(a,m) = -omega_a(a-G(s,m)); F_m(a,m) = -omega_a(a-a_0)Cpartial_mG(m)$

$ G(m)= 1/(1+e^{-2m}) $

$omega_m, omega_a, Delta_m, Delta_a, C$ are all constants. I chose $beta = 0$ and s = 1.

The problem has no flux boundary conditions:

$J_m(a,m=0)=J_m(a,m=4)=J_a(a=0,m)=J_a(a=1,m)=0.$

However, the only solution I get is zero.

This is my code:

Subscript(K, 0) = 1;
Subscript(K, d)(m_) = Subscript(K, 0) E^(2 m);
H = 1;
s = 10;
G(m_) = 1/(1 + (s/Subscript(K, d)(m))^H)
Subscript((Omega), m) = 5;
Subscript((Omega), a) = 50;
Subscript((CapitalDelta), m) =  0.01/2;
Subscript((CapitalDelta), a) = 0.01/2;
Subscript(F, m)(a_, m_) = -Subscript((Omega), a)*(a - G(m));
Subscript(a, 0) = 0.5;
Subscript(C, 1) = (
  Subscript((CapitalDelta), m) Subscript((Omega), a))/(
  Subscript((CapitalDelta), a) Subscript((Omega), m));
(Beta) = 0;
Subscript(F, a)(a_, m_) = 
  Subscript((Omega), 
   m)*(a - Subscript(a, 
     0))*((Beta) + (1 - (Beta))*Subscript(C, 1)*!(
*SubscriptBox(((PartialD)), (m))(G(m))));
Subscript(J, m)(a, m) = 
  Subscript(F, m)(a, m) P(a, m) - Subscript((CapitalDelta), m) !(
*SubscriptBox(((PartialD)), (m))(P(a, m)));
Subscript(J, a)(a, m) = 
  Subscript(F, a)(a, m) P(a, m) - Subscript((CapitalDelta), a) !(
*SubscriptBox(((PartialD)), (a))(P(a, m)));
eqn = -!(
*SubscriptBox(((PartialD)), (m))(
(*SubscriptBox((J), (m)))(a, m))) - !(
*SubscriptBox(((PartialD)), (a))(
(*SubscriptBox((J), (a)))(a, m)));
ufun = NDSolve({eqn ==  
    NeumannValue(
      Subscript(F, m)(a, 0)/Subscript((CapitalDelta), m) P(a, m), 
      m == 0) + 
     NeumannValue(
      Subscript(F, m)(a, 4)/Subscript((CapitalDelta), m) P(a, m), 
      m == 4) + 
     NeumannValue(
      Subscript(F, a)(0, m)/Subscript((CapitalDelta), a) P(a, m), 
      a == 0) + 
     NeumannValue(
      Subscript(F, a)(1, m)/Subscript((CapitalDelta), a) P(a, m), 
      a == 1)}, P, {a, 0, 1}, {m, 0, 4})

Can anyone please help and let me know what I am doing wrong. Thanks in advance.

NDsolve diferencial equation problem – Mathematica Stack Exchange

I am trying to solve a differential equation using NDsolve, but I keep getting this error message :(NDSolve::ndnum Encountered non-numerical value for a derivative at t == 0);

This is the equation :NDSolve({0.000064 v'(t) == (3/4 1000/(980 0.005) 0.000064 (24*((1 + 0.15 ((v(t) 0.005)/(8.910^-4))^0.687)/((v(t) 0.005)/(8.910^-4))) v(t)*v(t)) – (0.000064 9.8 (1 – 1000/980))), v(0) == 0.01}, v, {t, 0, 3})

Does anyone have suggestions on how can I solve it?
equation

differential equations – How to solve NDSolve dependent on two NIntegrates?

 Kab(n_, z_) := NIntegrate((1 + (t*n)/(f0(z))^2), {t, 0, 1});
 S4(n_, z_) := NIntegrate((t/(n*(f0(z))^2)*Exp(-2*Kab(n, z)*z)), {t, 0, 1});
 Com(n_, z_) := NDSolve({(f0'(z)) == n*Exp(-2*Kab(n, z)*z)*S4(n, z), f0(0) == 1, f0'(0) == 0}, f0, {z, 0, 3});
  ca(n_, z_) = Com(2, z)
 Plot(Evaluate(f0(z) /. ca(n, z)), {z, 0, 3})

My code is given above. I am unable to get the plot and getting some errors.

differential equations – how we can extract the value of the solution of a PDE in a point x? (NDSolve)

Please I need your help, I calculate the solution of heat equation using methode of line
This is my code:

n = 10    
grid = 1/n  Range[0, n];
d1 = NDSolve`FiniteDifferenceDerivative[Derivative[1], grid];
d2 = NDSolve`FiniteDifferenceDerivative[Derivative[2], grid];
M1 = d1["DifferentiationMatrix"];
M2 = d2["DifferentiationMatrix"];
y00[t_] := Sqrt[2] Sin[Pi t];
T= 0.02;
tab = Table[u[i]
tab1 = Table[u[i], {i, Length[grid]} ];
ux = M1.tab;
uxx = M2.tab;
solu1   = D[u[1]
solu2 = D[u[n + 1]
solu3 = Table[D[u[i]
solu4 = Table[u[i][0] == y00[grid[[i]]], {i, Length[grid]}];
sol1 = NDSolve[{solu1, solu2, solu3, solu4}, tab1, {t, 0, T}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       "MaxPoints" -> 25}}];

Now that I have calculated the solution “sol1”. I need to approximate the value of this solution in $t = T$ in the space $ grid$ something like

h = Table [sol1 [grid[[i]],T],{i,Length[grid]}]

but this is not working for me, can anyone help me with that please??

differential equations – NDSolve of a stiff system of ODE’s

I am trying to solve numerically the following set of differential equations

eqs = { 
D L^2 c'(y) - L my(y) == 0, 
D L^2 my''(y) - L (Qyy'(y) + c'(y)/3) - my(y) == 0, 
D L^2 Qyy''(y) - (4/15) L my'(y) - Qyy(y) == 0,

c(-1) - L my(-1) - 1/(3 D) == 0,
D L^2 my'(-1) - L (Qyy(-1) + (1 + c(-1))/3) == 0, 
D L^2 my'(1) - L (Qyy(1) + (1 + c(1))/3) == 0,
D L^2 Qyy'(-1) - (4/15) L my(-1) == 0, 
D L^2 Qyy'(1) - (4/15) L my(1) == 0
}

What I am actually interested is the solution to above set of equations for the parameters D and L being from the interval (0,1). For not too small values of D, and L, one can just simply use NDSolve without any further problems to obtain an accurate solution.

For small values of D and L, for example D = 1/2, and L = 1/10, the solution is very stiff close to the boundaries y = – 1, and 1, so that the solution is problematic

pars = {D -> 1/2, L -> 1/10};
sol = NDSolve(eqs /. pars, {c, my, Qyy}, {y, -1, 1});
Plot(c(y) /. sol, {y, -1, 1}, PlotRange -> All)
NDSolve::bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution. If a solution is computed, it may match the boundary conditions poorly.

NDSolve::berr: The scaled boundary value residual error of 2.9891304910534367`*^10 indicates that the boundary values are not satisfied to specified tolerances. Returning the best solution found.

enter image description here

First approach

My first idea was to solve this problem using StiffnessSwitching method, but this does not automatically solve the problem

pars = {D -> 1/2, L -> 1/10};
sol = NDSolve(eqs /. pars, {c, my, Qyy}, {y, -1, 1}, 
   Method -> "StiffnessSwitching");
Plot(c(y) /. sol, {y, -1, 1}, PlotRange -> All)
NDSolve::bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution. If a solution is computed, it may match the boundary conditions poorly.

NDSolve::berr: The scaled boundary value residual error of 1.631995982197461`*^8 indicates that the boundary values are not satisfied to specified tolerances. Returning the best solution found.

enter image description here

I assume the problem is related to the mesh that StiffnessSwitching method is using. I could in principle set MaxStepSize -> 0.001, but I guess this makes the whole StiffnessSwitching method useless if the MaxStepSize is smaller than the step size used in StiffnessSwitching. Is there a different way of approaching this problem? Is there a way of telling mathematica to use a finer mesh, but to preserve the uneven distribution of points convenient for dealing with stiff functions?

Second approach

I also tried to solve this problem using spectral methods. If I understand the documentation correctly
(https://reference.wolfram.com/language/tutorial/NDSolveMethodOfLines.html)
the following code should solve the equations on the Chebyshev grid, but the result does not seem to differ from the original approach that was done without specifying any Method at all

pars = {D -> 1/2, L -> 1/10};
points = 80;
sol = NDSolve(eqs /. pars, {c, my, Qyy}, {y, -1, 1}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       "DifferenceOrder" -> "Pseudospectral", "MaxPoints" -> points, 
       "MinPoints" -> points}});
Plot(c(y) /. sol, {y, -1, 1}, PlotRange -> All)
NDSolve::bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution. If a solution is computed, it may match the boundary conditions poorly.

NDSolve::berr: The scaled boundary value residual error of 2.9891304910534367`*^10 indicates that the boundary values are not satisfied to specified tolerances. Returning the best solution found.

enter image description here

Is there something I am missing in here? Even varying the number of points does not seem to have any effect on the result.

Unable to solve this differential equation with NDSolve. NIntegrate::inumr error

My code goes as follows:

(Alpha) = 1; n = 2;
g((Omega)_) = PDF(NormalDistribution((Alpha), n*(Alpha)), (Omega))
f(t_) := NIntegrate(g((Omega))*Exp(I*((Alpha) - (Omega))*(t)), {(Omega), 0, 10})

Everything is fine up to this point. And, finally, I want to evaluate:

NDSolve({G'(t) + NIntegrate(f(t - v)*G(v), {v, 0, t}) == 0, G(0) == 1}, G, {t, 0, 1})

But, I get error:

NIntegrate::inumr: The integrand E^(-I v (1-(Omega))-1/8 (-1+(Omega))^2)/(2 Sqrt(2 (Pi))) has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,10}}.
…… x3

General::stop: Further output of NIntegrate::inumr will be suppressed during this calculation.

Why is it unable to evaluate this integral numerically?