Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.

1
vote
0answers
42 views

How to solve a stiff non-linear differential equation?

I am having trouble solving the following differential equation, where $\theta(x)$ is a phase, \begin{equation} \frac{d\theta}{dx} + \sin^2 \left[ \theta(x) \right] + K^2(x) \cos^2 \left[\theta(x) \...
3
votes
2answers
84 views
+50

Getting additional control over MaxRecursion/PlotPoints

I'm occasionally in a position where I need to compute a RegionPlot with some small area of the plot being computationally much more expensive then the rest of the ...
0
votes
0answers
31 views

Weird fluctuations in DensityPlot

I have a really long multi parameter Lorentzian function: ...
1
vote
1answer
48 views

How can I solve this non linear system of ODEs using NDSolve?

I want to find solutions to the system: $$\begin{align*} -2b'(s)\sin(b(s)) &= \sin(b(s))(a'(s)b''(s) - a''(s)b'(s)) - (a'(s))^3 \sin^2(b(s))\cos(b(s)) \\ &(a'(s))^2\sin^2(b(s))+(b'(s))^2 = 1\...
1
vote
1answer
51 views
5
votes
0answers
47 views

Details of NDSolve calling LSODA

Inspired by my question regarding the computation time of NDSolve using the LSODA backend I was wondering how NDSolve is actually calling LSODA (what arguments are sent to LSODA), i.e. what are the ...
0
votes
1answer
44 views

Numerical Approximation of erfc

I have a crazy output. I already tried the N[] function. All it does is condense the inputs. Any idea of how to have a numerical output from the code?
0
votes
0answers
29 views

Numerical error General::munfl: encountered in a simple computation

There is a similar General::munfl: error in Mathematica 11.3.0, where it occurs when computing Log[Exp[-800.`]]. But in my code,...
2
votes
2answers
49 views

NDSolve producing message Power::infy

I am trying to solve geodesic equations in some 3D black hole spacetime. It is a coupled ODE system with boundary conditions. Due to the symmetry of the spacetime, I expect the solutions to be even ...
2
votes
0answers
85 views

Derivative of an interpolation function is noisy

I have a set of numerical data of 1501 points, in the form of $\{x_i,a_i\}$ which I uploaded to here and here. I need to compute the numerical derivative of this data. In particular, I need the ...
3
votes
1answer
106 views

Newton's Method

Problem statement: I'm currently new to Mathematica and have been trying to solve this problem. I was digging around and found this code: ...
0
votes
0answers
34 views

Problem with significant digits [duplicate]

I wrote this short code ...
1
vote
1answer
73 views

How to get solutions for this system of inequalities?

I am new to Mathematica and I am struggling finding the solution for the following problem. I am studying this piecewise function: ...
1
vote
0answers
21 views

Inverse of Normal Distribution CDF incorrect for large value?

I have a function F which is the CDF of the standard normal distribution. The inverse of F should be infinity at 1. However, I ...
3
votes
0answers
128 views

On Ж, and the fine-structure constant

I'm trying to reproduce the results from a certain infamous paper that has been moving around the web for the last few days. The details are irrelevant. This paper claims to have a closed-form ...
2
votes
1answer
76 views

Computing numerically infinite sum of some double series

Let's consider the series: $$ F(t) = \sum\limits_{n=0}^{\infty}\sum\limits_{k=0}^{\infty} \frac{(-b)^k(-a)^n\binom{n+k}{k} t^{2n+k(2-\alpha)}}{\Gamma(2n+k(2-\alpha)+2)} $$ where $a,b$ are ...
1
vote
0answers
65 views

Is it possible to solve following question about integer programming using mathematica?

Consider a $5$-uple $(r,a,b,c,s)$ with $a,b,c\in\mathbb{Z},s\in\mathbb{Q}_+,r\in\mathbb{Z}_+$, denote $\frac{1}{2}(a^2-b^2-c^2)-\frac{s}{r}$ by $\Delta(\mathbf{v})$. Let $A$ be a positive real number....
14
votes
4answers
247 views

Terrible accuracy of DawsonF

DawsonF[30.] returns 0. The correct value is 0.016676... At least it prints a warning message, ...
0
votes
3answers
78 views

Using WhenEvent to Change the Sign of a Constant

I am attempting to change the sign of a constant when a certain condition is met during a numerical integration. Here is the code: ...
5
votes
2answers
111 views

Integrating a bivariate distribution over a region bounded by a straight line

Summary of problem: I'm using Mathematica version 8 to try to integrate the bivariate distribution over a region bounded by a straight line. The two random variables are uncorrelated. When I use ...
2
votes
1answer
52 views

Taking a derivative of an eigenvector

I'm trying to calculate the derivative of an eigenvector that I obtain by ...
1
vote
1answer
76 views

Help to extend this evaluation!

I'm performing a stochastic evaluation, where i'm interested in the assymptotic behavior of the solutions, but my computer can't stand very large times. So I thought that I could evaluate a certain ...
0
votes
1answer
44 views

Numerical solution of an ODE using NDSolve

I am to find the solution $R(\rho)$ to the following differential equation, $\frac{\partial}{\partial\rho}\left(A^2\frac{\partial}{\partial\rho}R(\rho)\right)-l(l+1)R(\rho)=0$ where $A$ is a ...
0
votes
3answers
108 views

How to solve these equations numerically?

I have some differential equations as below. I have tried to solve them numerically with NDSolve: ...
0
votes
0answers
46 views

Solving differential equation (with numerically-inverted functions inside it)

I have a routine for numerically inverting a function and i want to inject this function (routine) into a differential equation. Now, i am solving the differential equation with DSolve but it just ...
2
votes
2answers
215 views

Solving 2D+1 PDE with Pseudospectral in one direction with periodic boundary condition?

According to the documentation about the pseudospectral difference-order: It says: Following the discussion here: I found the messy behavior is always on the artificial boundary in $\omega$-...
0
votes
1answer
49 views

How can I plot the solutions to this system of non linear ODEs?

I need to solve the following system: $$\left\{ \begin{array} { l l } { (u')^2 + (v')^2 = 1 } \\ {u'v'' - u''v' = uu' + vv' } \end{array} \right.$$ and it's a task that's proven to be quite hard by ...
-1
votes
1answer
62 views

Numerical Inversion of an incomplete beta function expressed as gauss hypergeometric function using Mathematica

I am currently working with this hypergeometric function ${_2}F_1$, $\rho(r)=\frac{2b}{1-q}(1-(\frac{b}{r})^{1-q})^{\frac{1}{2}}{_2}F_1(\frac{1}{2},1-\frac{1}{q-1},\frac{3}{2},1-(\frac{b}{r})^{1-q})$ ...
2
votes
0answers
41 views

What is the acceptable error in numerical calculations? [closed]

I am doing a calculation where I try to simplify a very complicated complex function. I did this step by step and I checked that the numerical values that the function gets for certain values of the ...
4
votes
2answers
162 views
2
votes
2answers
155 views

Unstable solution of 2D+1 time PDE with periodic boundary condition

Now I am trying to solve the following 2D+1 type of PDE: $\partial_t u(t,x,y)=-y\partial_{x}u+\partial_{y}\left[a y+b sin(x)u+c\partial_{y}u\right]$ with $u(0,x,y)=\frac{1}{2\pi}e^{-((x-\pi/4)^2+y^2)...
0
votes
1answer
107 views

What is wrong with this MonteCarlo? [closed]

I am making a trial for a MonteCarlo. In this code I simulate 10 protons hitting on a slab of gold: ...
2
votes
1answer
72 views

How would one go about plotting this parameterized curve using numerical resources (analitically it's too hard)?

I'm working with the system of differential equations: $$\begin{align*} \left\{ \begin{array} { l l } { (u')^2 + (v')^2 = 1 } \\ {u'v'' - u''v' = -v' + u' } \end{array} \right. \end{align*}$$ Where $...
2
votes
1answer
71 views
3
votes
1answer
55 views

Machine Epsilon is not equal to $MachineEpsilon

I try to wrap my head around machine precision calculations in Mathematica (11.2, Linux). I do not understand the following behavior: ...
1
vote
0answers
31 views

Determine if nonlinear function can be positive subject to nonlinear constraints [closed]

I am trying to determine if a certain nonlinear function can be positive when the variables have to satisfy multiple nonlinear constraints. Currently my code looks like ...
6
votes
4answers
113 views

Suppress trailing 0s in numerical values

For example, this is what I want In[1]:= N[Table[4^(i/4), {i, 1, 4}]] Out[1]= {1.41421, 2., 2.82843, 4.} But if I want a few more digits only from the irrational ...
3
votes
2answers
140 views

Increase Performance of WhenEvent in NDSolve

I'm trying to reset the value of functions $u_{i}$ when they reach a threshold $θ$. Below the threshold, they evolve according to a simple differential equation. The $r_{i}$ resets the derivative to ...
2
votes
0answers
96 views

How to Solve this Fokker-Planck Equation?

I need to solve this Fokker-Planck equation in Mathematica and my attempt to perform this integration is above: My first attempt is above: ...
0
votes
2answers
58 views

Computing a sum with high precision

I am aware that a similar question has been asked, for example, here and here, but none of the proposed solutions solves my problem, so please wait before you mark this question as a duplicate. ...
15
votes
1answer
206 views

What happened to SequenceLimit?

In older versions of Mathematica, there was a function called SequenceLimit that allowed taking the limit of a numerical sequence. It is useful for speeding up the ...
2
votes
1answer
43 views

FindMinimum finds a zero value for solving a system but does not converges. Can I interpret it as the solution for system?

I am solving a system of three non-linear equations for three unknowns. I am using FindMinimum to minimize the norm of residuals of the system. I have played a lot ...
1
vote
0answers
30 views

Solve the 'Eigenvalue' problem efficiently [closed]

Usually, an eigenvalue of a matrix A is defined as |A-b*I|=0, where I is the identity matrix and |..| is for the determinant. Now my question becomes a little different, let's say A is a function of ...
3
votes
2answers
221 views

Solve PDE involving implicit function of independent variables

I have a differential equation given by -4*D[S[u,v],u,v]==V[u,v]*S[u,v] with boundary conditions ...
1
vote
1answer
36 views

Precision error in FindMinimum

I am trying to solve a system of three non-linear equations for three unknowns (e1, e2, phi). I am using FindMinimum to solve the system (I am minimizing the norm ...
1
vote
1answer
60 views

How to make Mathematica show small and large results? [closed]

I have two equations with x=r+Log[-1+r] and v=(1-1/r)/r^3 forms. When I substitute ...
3
votes
1answer
86 views

Problem with the function N with second argument

I was asked to look at a complicated definite integral that could be integrated analytically, but numerically did not behave as expected. After a lot of simplifications I arrived at the following: <...
2
votes
1answer
55 views

How can NDSolve be used to get just the positive or just the negative energy solution to the Klein-Gordon equation?

The Crank-Nicolson technique below is obtained from: "http://reference.wolfram.com/language/tutorial/NDSolvePlugIns.html" ...