44 votes
Accepted

In what way can M11.3's system modelling features be used by those who don't have SystemModeler?

I'm one of the developers behind this functionality, so I might be biased, but in my opinion this does provide a huge new feature set to Mathematica users. What practical use do these new functions ...
Malte Lenz's user avatar
  • 2,471
28 votes
Accepted

Backtesting a Probability of Default (PD) model

This kind of backtest is often performed using approximations, for instance with normal distributions, which may not be always valid. An exact test would be very nice to have. The probability ...
Sjoerd C. de Vries's user avatar
24 votes

My Girlfriend is going to prison...Save her with Math

Similar to previous answers, only I don't make the instantaneous absorption assumption since it isn't really necessary. The equation can be found here on page three, where ka and ke are the rates of ...
bobthechemist's user avatar
22 votes
Accepted

Couple a PDE and ODE in NDSolve

Modified Newton Cooling Law implementation and reduced FEA cell length ...
Young's user avatar
  • 7,485
16 votes
Accepted

Sound synthesizer using Manipulate

First let me observe that your coding style makes debugging difficult, I highly recommend breaking giant expressions into manageable pieces. Second, in the code below I have used a different ...
Simon Woods's user avatar
  • 84.6k
16 votes

Generating random sequence of integers with ordering constraints

Perhaps have a look at DiscreteMarkovProcess using an appropriate transition matrix embedding your constraints? Here's a simple example, implementing 1-5 above, to ...
George Varnavides's user avatar
16 votes
Accepted

How to Create Kapitza's Pendulum?

After small modification we have ...
Alex Trounev's user avatar
  • 41.8k
14 votes

My Girlfriend is going to prison...Save her with Math

Assuming the simplest kinetic model for elimination (and making the simplifying assumption of "instant absorption" to peak concentration): ...
ubpdqn's user avatar
  • 58.7k
14 votes

Mass Transport Model

OK. Let me extend my comments to an answer. First of all, I'd like to point out why OP's attempt doesn't work: "NDSolveValue should return a list with three ...
xzczd's user avatar
  • 63.4k
13 votes
Accepted

My model has not finished evaluating in more than a day so can't test if it works, what is wrong with it?

Here a couple of changes/suggestions. Using a decimal dot for all constants forces most algorithms to switch from symbolic to numeric routines with machine floating point arithmetic; that's typically ...
Henrik Schumacher's user avatar
12 votes
Accepted

Why does NonlinearStateSpaceModel linearise?

Consider a model where the nonlinearity is in $x'(t)$ and not in the highest derivative $x''(t)$. eq1 = {x''[t] + Sin[ x'[t]] + x[t] == u[t]}; Choose the first ...
Suba Thomas's user avatar
  • 8,576
12 votes
Accepted

Can I use a differential equation as a model to make a fit to experimental data?

Mimicking the examples in FindFit >> Applications >> DifferentialEquations NonlinearModelFit >> Generalizations and Extensions ...
kglr's user avatar
  • 384k
12 votes
Accepted

Speed up NDSolve compared to Python (calls to LSODA)

First question. I'm pretty sure that the difference is due to what happens with machine underflow. As of V11.3, underflow goes to machine zero instead of to arbitrary-precision numbers (as it does in ...
Michael E2's user avatar
  • 233k
12 votes

Large deformation of solids

It is not 2D problem, but 3D problem. So we actually need some 3D model to describe deformation. But before do this, we can describe the problem in the beam theory. Fortunately, this problem has exact ...
Alex Trounev's user avatar
  • 41.8k
11 votes
Accepted

Implementing the Biham–Middleton–Levine traffic model as CellularAutomaton

The following code simulates the Biham-Middleton-Levin traffic model for 1000 iterations using explicit rules. According to Wikipedia the blue and red cars take turns to move, which means each step is ...
C. E.'s user avatar
  • 69.9k
11 votes
Accepted

Use a picture as the initial distribution of an agent based model

You have to use ColorNegate and other image processing functions to make the area that you want to sample is white, while the rest is black. After that you can use <...
C. E.'s user avatar
  • 69.9k
11 votes
Accepted

Large deformation of solids

I think you guys are using the wrong theory, as far as I understood the code above. Sadly I only have little time, and in this answer I can only give you the theory without code. If I read your code ...
Mauricio Fernández's user avatar
11 votes
Accepted

Refining mesh size leads to absurd results for a coupled heat transfer FEM model

This is a typical numerical instability due to FEM matrix inversion. On the fine mesh there are big numbers in Navier-Stokes equation of about $1/h^2$, therefore at $h\rightarrow 0$ we have singular ...
Alex Trounev's user avatar
  • 41.8k
10 votes

My Girlfriend is going to prison...Save her with Math

I have no experience with what you are trying to do so this is entirely guesswork but maybe you want something like this? ...
Mr.Wizard's user avatar
  • 270k
10 votes

Why does NonlinearStateSpaceModel linearise?

My guess is to be able to have the same internal representations as for linear systems. It is not possible to represent a system using A,B,C,D state space standard ...
Nasser's user avatar
  • 136k
10 votes

Mathematica code for bifurcation diagram in 3D

Looks like a little three-species food web model -- a perfect excuse to use my new EcoEvo package. First, install the package (one-time only): ...
Chris K's user avatar
  • 19.5k
10 votes

How to Create Kapitza's Pendulum?

Elaborating on Alex Trounev's solution. The trick with this inverted pendulum is, that for some frequencies it stays upright instead of falling down. Here is an example where I adjusted the frequency. ...
Daniel Huber's user avatar
  • 47.1k
9 votes
Accepted

Why doesn't Mathematica completely draw the fit?

Add the option PlotRange (say PlotRange -> {{0, .006}, {0, 90}}), and use data2 as <...
kglr's user avatar
  • 384k
9 votes

Mass Transport Model

Thanks to @xzczd answer we can reproduce solution with FEM. First we should note that $[A]+[B]+[C]=[A]_{bulk}$ in a case of equal $D_A=D_B=D_C$, therefore we can exclude equation for $[A]$ and resolve ...
Alex Trounev's user avatar
  • 41.8k
8 votes

Solving Differential Equation System for HIV Treatment Model

Structuring the script. ...
Cesareo's user avatar
  • 3,683
8 votes
Accepted

Find best equation for data and the area under curve

A curve that is a multiple of a gamma distribution seems to fit: ...
JimB's user avatar
  • 40.3k
8 votes
Accepted

Time dependent Schrödinger equation in 2D

Something like the following should do. It employ the finite element method. ...
Henrik Schumacher's user avatar
8 votes
Accepted

Showing that a Hopf bifurcation exists?

We can use my EcoEvo package, despite the fact that this doesn't seem like an ecological model. First, install the package (only needs to be done once): ...
Chris K's user avatar
  • 19.5k
8 votes
Accepted

Numerically solving a system of SDE's with Levy noise?

To simulate Levy jumps we can use numerical model described in the paper Analysis of a stochastic SEIS epidemic model with the standard Brownian motion and Lévy jump. In this model we use ...
Alex Trounev's user avatar
  • 41.8k
8 votes
Accepted

Finding a continuous distribution that fits the empirical density of dataset $1,1/4,1/9,1/16\ldots$

Note: Edited to focus on the CDF rather than the moment generating function. If $X$ is a discrete random variable taking on values $1,1/2^2,1/3^2,1/4^2,\ldots$ with relative frequencies $1,1/2^2, 1/3^...
JimB's user avatar
  • 40.3k

Only top scored, non community-wiki answers of a minimum length are eligible