Stack Exchange Network

Stack Exchange network consists of 175 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 tagged [numerics]

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

2
votes
2answers
45 views

Identifying points in the frontier of a set

Let me start with an example. Let $$\mathbf{A}=\begin{bmatrix}3&1\\2&3\\1&5\end{bmatrix},$$ and let $Q=\{\mathbf{q}\vert\mathbf{q}\in\Bbb R^3_+ \land \sum_i^n q_i=1\}$ and $\alpha=(.5,.5,...
0
votes
1answer
52 views

How to solve this equation numerically? [on hold]

Two Gaussian functions: f1,f2 of the form f1 = a1*Exp[-t^2/s1^2]. Total area, Atot of (f1+f2) is known. Height of each peak (a1 and a2) is known (experimental ...
3
votes
2answers
83 views

How to solve these ODEs using NDSolve?

I have six odes and I cannot use DSolve. So I tried NDSolve. But it says there may be some errors.The code is such like this: ...
7
votes
2answers
669 views

Does Mathematica reuse previous computations?

I am doing an analysis of experimental results in which I need to repeat the same GaussianFilter hundred of times on different data. As explained in the ...
2
votes
0answers
56 views

Wrong result using “numeric” symbols

Recently I stumbled upon a weird bug when I used a package that sets the NumericQ result of symbols you are feeding into a certain function to true. Here is a minimal working example of what I mean: ...
2
votes
0answers
63 views

How to avoid getting different results in exponential and trigonometric forms [on hold]

I have a complicated numerical complex expression which depends on 6 parameters (Alpha, Beta, Gamma, Delta41, Delta43, Delta). It is too long to put it all here but this is what it looks like: ...
0
votes
1answer
34 views

Problem with {table values} when plotting

I have a Piecewise and Nintegrate both defined with NumericQ. The NIntegrate part of the Piecewise operates when first inserted into a working program, but not when called from inside a table. Their ...
0
votes
0answers
43 views

NIntegrate problems [on hold]

Sorry, I am boxed in by Mathematica again, every exit being blocked and can't find any answers on the web. This usually happens once the code is lengthy so it is hard to debug and to show with the ...
2
votes
2answers
89 views

Numerically stable replacement for generalised incomplete gamma function

I am looking to replace the generalised incomplete gamma function (which appears in a solution to a problem I've posted about here) with a numerically stable formula involving other functions. This is ...
2
votes
1answer
64 views

How to maximize just with respect two parameters out of four?

There are some posts explaining how do we maximize a function of two parameters with respect to one of those and how to plot the resulting function: Plot a function after taking the supremum with ...
1
vote
2answers
95 views

Evaluation of a hypergeometric function

I am working with functions like f[z_] = Hypergeometric2F1[4, 4, 8, z] Here is a plot of this function over the interval $z \in [0,1]$: ...
2
votes
1answer
40 views

Plotting numerical solutions (multi solutions)

I am trying to plot the solutions of this equation. ...
3
votes
1answer
41 views

Calculation among Gamma functions

I was calculating gamma functions in Mathematica while it does not give me an agreed answer. By definition, $\Gamma[\alpha]=\int_0^\infty t^{\alpha-1}e^{-t}dt$, $\Gamma[\alpha,z]=\int_z^\infty t^{\...
2
votes
0answers
81 views

Can this integral equation problem $\int_\Gamma \frac{e^{ik|x-y|}}{4\pi|x-y|}\varphi(y) \, \mathrm{d} y = u_{x_0}^{in}(x)$ be solved?

I am not sure if Mathematica is capable of solving integral equations in 2D/3D. I found this page in the documentation, but this is just for 1D. The following is what I would like to solve, it can ...
0
votes
1answer
66 views

Get rid of extra digits [closed]

I have an expression with lots of numbers such as 1.000000002, 2.0000000000001, ... and I would like to automatically set them to 1, 2, ... how can I do that?
0
votes
1answer
58 views

Find area under real part of complex curve without numerically integrating

I have a function defined within the domain 0<=x<=2*Pi. f = Cos[x] * (a - 1 - r*Cos[x])^1.5 on the domain: ArcCos[(a-1)/r] < x < 2*Pi-ArcCos[(a-1)/r] f = 0 elsewhere 'a' and 'r' are ...
0
votes
0answers
37 views

FindMinimum is running too slow

For defined a function h[x_?NumericQ], I can get a plot of the function from Plot function in about seven seconds. But when I ...
0
votes
0answers
109 views

Why can't Nsolve find the solutions for my equations?

I have a problem using NSolve in my Mathematica code. In my Code NSolve should find a value for qw, but it won't. The strange ...
2
votes
3answers
69 views

Exponentials don't cancel numerically [closed]

I'm trying something essentially like N[Exp[-x]*(D[Exp[x*y^2], y] /. y -> 1)] After differentiation and y -> 1 there is ...
0
votes
1answer
55 views

DFT and continuous Fourier transform gives different result? [closed]

I am working on the inverse Fourier transform of $\frac{\sqrt{|k|}}{i(|k|-\omega)-\Gamma}$ with $\omega=100, \Gamma=1$. For continuous Fourier transform, I get the following result: ...
2
votes
3answers
286 views
5
votes
2answers
110 views

How to preserve normalization in NDSolve?

I have a probability density function: $P_{init}(x)=\exp(-(x-x0)^2)/\sqrt{\pi}$. I am trying to use it as the initial condition for the following partial differential equation: ...
1
vote
0answers
23 views

Numerical continuation methods for bypassing a singularity when integrating an ODE

Here is the ODE I want to numerically integrate, odey=-l (1 + l) R[y] + (k - y) (-2 Derivative[1][R][y] + (k - y) (R^\[Prime]\[Prime])[y]) If we rearrange it in ...
2
votes
5answers
145 views

Calculating the Dottie number using an infinite series

The Dottie number is the solution to the equation $\cos(x) = x$ It is approximately equal to $0.739085133215160641655312.$ This number can be expressed analytically in the following form (see this ...
3
votes
2answers
81 views

Legendre polynomials that evaluated with huge difference

I'm dealing with Legendre polynomials, involving the first kind, second kind, and the associated ones. However, I found this: ...
0
votes
0answers
76 views

How can I solve this KdV equation numerically by Mathematica?

I have been trying to solve the following Korteweg-de Vries (KdV) equation using NDSolve but nothing went right! \begin{align} 6 U_{t} + \frac{9}{2} U_{xxx} + 9 U U_{x} - 6 a U_{x} = 0\\ U_{...
0
votes
3answers
126 views

NDSolve fails at the regular singular point of a second-order ODE

Here is the ODE I want to numerically integrate, odey=-l (1 + l) R[y] + (k - y) (-2 Derivative[1][R][y] + (k - y) (R^\[Prime]\[Prime])[y]) If we rearrange it in ...
0
votes
1answer
60 views

NDSolve and interpolating function

What could possibly went wrong in my code? Basically, I am solving the differential equation $\textbf{ode}$ using $\textbf{NDSolve}$. But mathematica says, NDSolve::mxst: Maximum number of 10000 steps ...
0
votes
0answers
37 views

Optimising the NSolve

Suppose I have the following list of rational functions, ...
1
vote
0answers
90 views

Help in minimizing a cumbersome function

I'm trying to minimize a function in order to find a slope critical heigth on a solope stability analisys. The functions taken from (Chen 1975) are the following: I added all the equations to mma but ...
0
votes
0answers
42 views

Devise a compact storage mode

I am writing a code for solving a symmetric band matrix by Cholesky decomposition. I need to store the matrix by defining only the non-zero diagonals of the matrix not the full matrix with band size $...
3
votes
1answer
85 views

Approximating decay rate of an amplitude and frequency of an oscillating function

I have an InterpolatingFunction constructed from a discrete set of values obtained by numerical methods. Let's denote it $f(x)$. The function demonstrates an ...
4
votes
1answer
96 views

Numerically computing the eigenvalues of an infinite-dimensional tridiagonal matrix

I have one infinite dimensional tridiagonal matrix whose eigenvalues I have to compute. How can that be done numerically using Mathematica? Let me expose the concrete case I want to do it. I shall ...
8
votes
7answers
1k views

How to display very small numbers in Mathematica?

I am trying to evaluate the function: $$f(x) = \cos(x) - \mathrm{e}^{-2.7 x}$$ at $x = 1.7 \times 10^{-25}$ and Mathematica keeps returning '0.' How do I evaluate the expression in a better way?
3
votes
2answers
149 views

Solution or artifact?

I am trying to increase the precision of the code ...
1
vote
2answers
116 views

Multivariate Newton-Raphson method and FindRoot module [closed]

Let's suppose that we have the following equation ...
5
votes
2answers
143 views

Does Mathematica gives us a wrong result for the integral of a function including elliptic functions?

Calculus tells us that the differentiation of the integral of a function should be itself, but at least in one case Mathematica answers NO. I feel very confused. The new figure seems to bifurcate at ...
3
votes
1answer
89 views

Problem with the Inverse CDF of Non-central F Ratio Distribution

In[3]:= n = 5; n1 = 4; n2 = 6; γ = 0.05; α = 1/370; InverseCDF[NoncentralFRatioDistribution[1, n1 - 1, n1/γ^2], 1 - α - (n - n1)/n2] During evaluation of In[3]...
0
votes
0answers
41 views

Numerical solution to approximate the singular integration using collocation method

I am working to solve "numerically" the following integral equation IE: u[x]=f[x]+Integrate[(1/(x-t)^(1/4))*u[t],{t,0,x}]+Integrate[(1/(x-t)^(1/4))*u[t],{t,0,1}] ...
5
votes
1answer
118 views

Recycling solutions of multidimensional NDSolve

Dear wolfram community, I hope my problem is clear and easy to solve. I have already solved the following heat equation over a domain: ...
0
votes
1answer
102 views

Problems with numerical integration

I tried to plot beam intensity using a function that evaluates a numerical integral, but it didn't work. Here is my code, which did not produce a result. ...
6
votes
2answers
175 views

Catastrophic loss of accuracy in Orthogonalize

Context In connection to this question I am interested in orthogonalizing known matrices. As a test case, let us consider the definite positive $15 \times 15$ matrix ...
0
votes
1answer
66 views

Good practice about numerical precision

In one of my calculations, I get -1.11022*10^-16 as one of my eigenvalues for a matrix. It's essentially zero and I suppose I could use SetPrecision to make it zero but I wonder what's a good practice ...
0
votes
1answer
57 views

Increasing MaxExtraPrecision arbitrarily changes numerical result

I am trying to confirm that a function $f$ satisfies a particular differential equation of the type $D f=0$, for some differential operator $D$. I set $Df$ as Diffeq...
4
votes
3answers
275 views

Turn the following values into percentage [closed]

I have the following data: {2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017} {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216} My data is already in Matrix form in ...
0
votes
0answers
45 views

High numerical precision failing [duplicate]

N[(1 - 2*6.674*6*10^13/(6371000*299792458^2))^(0.5), 20] 1. What I expect: ...
1
vote
2answers
170 views

A numerical boundary conditions paradox

For $(t,z)\in[0,1]\times[-1,0]$ zmin = -1; tmax = 1; and some fields $w(t,z)$ and $y(t,z)$ ...
1
vote
1answer
31 views

NIntegrate fails with functions that have (necessarily) numeric lists as arguments

I'm not able to NIntegrate a function that has a numeric list as an argument. My original problem involves a compiled function, but a MWE is the following: ...
6
votes
1answer
130 views

Looking for examples of numerically solving coupled PDE and ODE

I am about to solve a system of coupled PDE and ODE in thermodynamics. My system is a bit complicated, so I would like to learn from some examples before coding my own system. I searched this site ...
0
votes
1answer
53 views

Wrong divergence with numerical value

this is my first question in this forum. I'm trying to evaluate some complicated function of, say, $x$ near $x=0$ (in order to integrate it later). The problem is that the numerical value of this ...