New answers tagged

5 votes
Accepted

Substitute solution into ODE to verify it holds

Using Function: FullSimplify[ode /. pi -> Function[x, piSol[x]]] === 0 (*True*)
E. Chan-López's user avatar
3 votes

NDSolve for nonlinear problems

To plot $dp/dx$ we can use Module as follows ...
Alex Trounev's user avatar
  • 43.5k
0 votes

Poincaré section of the particle motion near the black hole horizon

The resource function ["ClickPoincarePlot2D"] is also working now, thanks to the new update. I have also used the ScalarPureFunction by @E. Chan-López ...
codebpr's user avatar
  • 2,082
1 vote

NDSolve FEM-Solver fails for simple PDE

modified Extended comment to answer @user21. Meanwhile I could DiscretizePDE too. Here my code ...
Ulrich Neumann's user avatar
3 votes

NDSolve FEM-Solver fails for simple PDE

This is not an answer but an extended comment. I think it would be good to simplify and speed up your code and make sure the FEM computations are correct. Following the FEM Programming tutorial we get ...
user21's user avatar
  • 39.4k
0 votes

Help needed with the fitting and bug

Not a complete answer, but an extended comment with corrected code Here I try to prepare the solution for rData . As mentioned by @DanialHuber your ...
Ulrich Neumann's user avatar
4 votes

NDSolve FEM-Solver fails for simple PDE

To verifier solution computed with Galerkin method we can use the Euler wavelets collocation method from my answer here. We add boundary conditions at y==0 and <...
Alex Trounev's user avatar
  • 43.5k
6 votes

Problem with calculation of Lyapunov exponent

In your differential equations, replace Abs with RealAbs.
Domen's user avatar
  • 22.3k
1 vote
Accepted

Formulate and solve a system of linear, first-order ODEs in Mathematica

Starting all over again as correct equations posted. Since Mathematica index starts from 1 and not zero, it is easier to start your equations from 1 and not 0 as you showed. Let $\beta=\frac{S_{\gamma}...
Nasser's user avatar
  • 142k
1 vote

NeumannValue when differential equation does not use Laplacian

modified The NeumannValue for your problem is well defined. ...
Ulrich Neumann's user avatar
0 votes

NDSolve with InterpolatingFunction object

Make the right-hand side of the ODE a function of the variables: ...
Goofy's user avatar
  • 2,682
1 vote

Solving Maxwell's Equations in Mathematica

We can solve this problem numerically using the Lienard - Wiechert potentials discussed here and here. First we should note that 4 dimensional region $0\le t\le 10, -5\le x\le 5, -5\le y\le 5, -5\le z\...
Alex Trounev's user avatar
  • 43.5k
2 votes
Accepted

Help with plotting solution curves to the Gompertz equation

Maybe ...
cvgmt's user avatar
  • 69.9k
3 votes

Help with plotting solution curves to the Gompertz equation

This is what I get. Note, your latex and code do not match. I assumed it is the Latex which is correct. But what I get does not exactly match what you show. So I think your ode is still missing ...
Nasser's user avatar
  • 142k
1 vote

How to determine for which initial conditions a system of ODE gives negative results?

There's a singularity when $T=0$, but it seems possible that $T'$ can stay finite. ...
Goofy's user avatar
  • 2,682
4 votes
Accepted

How to determine for which initial conditions a system of ODE gives negative results?

How can I vary the initial conditions and see their effects on T solution? I mean make a Manipulate, something like this (the plot here is just T[t] and not the ...
Nasser's user avatar
  • 142k
7 votes
Accepted

Why can't I use logic operator Or to specify multiple events with WhenEvent?

After reading these very helpful posts here and here, it seems to be better to use a function to inlude multiple events. This conclusion is definitely wrong. Please notice the posts you've found are ...
xzczd's user avatar
  • 65.6k
2 votes

Failed to retrieve raw data from importing InterpolatingFunction derived from NDSolve

Export/import with ".m" files does not (it seems) preserve packed arrays. But InterpolatingFunction relies (it seems) on some of its data arrays being ...
Goofy's user avatar
  • 2,682
2 votes
Accepted

Failed to retrieve raw data from importing InterpolatingFunction derived from NDSolve

As we know file with extension .m is a plain text file, therefore all data in it are available to use. For example we generate file ...
Alex Trounev's user avatar
  • 43.5k
0 votes

How to improve the following code to get rid of the warning messages?

Try inverse problem X = Values@ DSolve[{ (y ^2 - 1) == x'[y] (2*x[y]*y ) , x[1] == 2}, x , y][[1,1]] Plot[X[y], {y, 0, 5}]
Ulrich Neumann's user avatar
5 votes
Accepted

How to improve the following code to get rid of the warning messages?

\begin{align*} y^{\prime} & =f\left( x,y\right) \\ & =\frac{2xy}{y^{2}-1}\\ y\left( 2\right) & =1 \end{align*} We see at $y=1,x=2$ the $f\left( x,y\right) $ is not defined. Hence ...
Nasser's user avatar
  • 142k
3 votes
Accepted

Is it possible to make a phase portrait of this system?

You have this system \begin{align*} x'(t)&=y(t)\\ y'(t)&=-(\omega_1^{2} x + \omega_2^{2} x^3) \csc(\alpha) \end{align*} Convert to state space. Let $x_1=...
Nasser's user avatar
  • 142k
0 votes

How to tell NDSolve to suppress creation of interpolation function on successful exit?

I think this is what you want. In the docs somewhere it says NDSolve with {t, a, b} and an initial condition at ...
Goofy's user avatar
  • 2,682
5 votes
Accepted

A problem with EcoEvo package

As @Domen noted, the package doesn't use [t] in defining a model since v1.6.0. At some point I'll fix old answers on this site to reflect that change. On to your ...
Chris K's user avatar
  • 20.1k
2 votes

An error concerning initial conditions in NDSolve

1. I'd recommend using ParametricNDSolve for this. But if not,... 2. The error is because NDSolve is evaluated before the ...
Goofy's user avatar
  • 2,682
4 votes
Accepted

An error concerning initial conditions in NDSolve

Try this version ...
Nasser's user avatar
  • 142k
3 votes

An error concerning initial conditions in NDSolve

With no errors: ...
Mariusz Iwaniuk's user avatar
1 vote
Accepted

Avoiding artificial diffusion and minimize changes to code

To be realistic, we can make boundary conditions as for inviscid flow and save small $\mu =10^{-3}$ to use FEM and NDSolve as it is, we have ...
Alex Trounev's user avatar
  • 43.5k
1 vote

How can I plot Lyapunov exponent as a function of parameter?

Probably too late for OP, but what the heck. I used the LyapunovExponents code from this answer. The following code steps through ...
Chris K's user avatar
  • 20.1k
2 votes
Accepted

NDSolve: how to solve "ndnum error"

We can solve this problem using the Euler wavelets collocation method and method of lines. Supposed that h[x,t] is a real function, we express ...
Alex Trounev's user avatar
  • 43.5k
4 votes
Accepted

Numerical Solution for a Non-Linear Functional Fractional Differential Equation (FFDE)

This is fractional delayed differential equation (FDDE), therefore we can't use method described in my answer here. Instead of the Haar wavelets method we try to use implicit difference scheme ...
Alex Trounev's user avatar
  • 43.5k
5 votes

How to tell NDSolve to suppress creation of interpolation function on successful exit?

You can tell NDSolve to only return the final value instead of an interpolation over the time interval, as noted in the NDSolve documentation (2nd line of Details section). For example: ...
tad's user avatar
  • 1,855
3 votes

How to tell NDSolve to suppress creation of interpolation function on successful exit?

Just replace the list of variables being solved for with an empty list. E.g. ...
Chris K's user avatar
  • 20.1k
0 votes

Problem with evaluation of integral

Maybe so: ...
Mariusz Iwaniuk's user avatar
2 votes

Transfer function for Rayleigh-Plesset equation

As Nasser alluded to, you can only have a transfer function of a nonlinear system by linearizing it about an operating point. Usually the operating point is the origin, but not for this system because ...
Suba Thomas's user avatar
  • 8,696
7 votes
Accepted

Numerical solution to fractional PDE

There are several numerical methods to solve fractional PDE. In this case the best one could be implicit difference scheme described in this paper. The implementation is not so difficult compare to <...
Alex Trounev's user avatar
  • 43.5k
8 votes

Transfer function for Rayleigh-Plesset equation

You can't have transfer function for nonlinear ode. You have to either first linearize it around some operating point, or use nonlinear state space representation. Mathematica has ...
Nasser's user avatar
  • 142k
10 votes

How Can I Plot the Phase-Frequency Curve Using Mathematica?

Method 1 : Using Bode Plot from signals and systems One more direct solution can be by making use of Mathematica's inbuilt BodePlot. You just need to find the ...
codebpr's user avatar
  • 2,082
7 votes

How Can I Plot the Phase-Frequency Curve Using Mathematica?

Code ...
Nasser's user avatar
  • 142k
2 votes

Integro-differential equation with double integral

This problem can be solved with the Euler wavelets collocation method even in v.8 as follows ...
Alex Trounev's user avatar
  • 43.5k
4 votes

Solving Integro-Differential Equation with Numerous Dependencies Using DSolveValue

modified Here is an iterative numerical solution $v_{n+1}(t)=\int_0^t \left(u'(\tau )-v_n'(\tau )\right) K\left[t-\tau ,\tau ,v_n(\tau )\right] \, d\tau$ which seem to converge very fast. First change ...
Ulrich Neumann's user avatar
0 votes

How to Plot the Steady State Phase Response Curve?

Is this what you want? The provided graph and the variables in the code are different. It is difficult to know what exactly you want to plot here. If possible please share the link where you get the ...
user444's user avatar
  • 2,354
1 vote

How to impose a change of variable in a differential equation?

If you want to do it with just plain substitution you can do this. ...
Bill Watts's user avatar
  • 8,177
1 vote
Accepted

Insert a nonlinear PDE in Mathematica

ClearAll[h, x, n, t] hx = D[h[x, t], x]; ht = D[h[x, t], t]; sqrtTerm = Sqrt[1 + 4*n*Abs[hx]]; ode = -Sign[hx]*1/2*D[ h[x, t]*(sqrtTerm - 1), x] == -ht Just do ...
Nasser's user avatar
  • 142k
2 votes
Accepted

How to plot the solutions to the following differential equation

Hint. First you need initial/boundary conditions. After observing the odes, the last one can be rearranged as $$ \frac{\ddot{\varphi}(s)}{\dot{\varphi}(s)}=-\frac{2\sin \theta \dot{\theta}(s)}{(2+\cos\...
Cesareo's user avatar
  • 3,963
2 votes
Accepted

Using ParametricNDSolve does not work for certain parameters

Here is a more compact approach that obtains w and a simultaneously. ...
bbgodfrey's user avatar
  • 61.4k

Top 50 recent answers are included