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

learn more… | top users | synonyms (1)

10
votes
1answer
246 views

Vastly incorrect answers obtained by increasing WorkingPrecision with modified Bessel functions

Bug introduced in 7.0 or earlier and persisting through 10.4.1 This is a follow-up to this question regarding numerical instabilities occurring with modified Bessel functions. In trying to explore J....
9
votes
4answers
463 views

Numerical instability in cosh and sinh - integral functions [duplicate]

I'm trying to calculate the function: CoshIntegral[x] Sinh[x] - Cosh[x] SinhIntegral[x] Unfortunately Mathematica seems to hit a point (x~20) and things become ...
9
votes
2answers
136 views

Finding self-intersections of a closed curve represented by an interpolation function

I've been trying to find particular simple closed curves on a plane. ...
8
votes
1answer
519 views

Converting other C++ classes to MTensor in LibraryLink

Hopefully this will be a quick question + a quick answer: Say I have a C++ (or C) code using LibraryLink. I am using a library that defines a specific matrix class, as many numerical libraries ...
7
votes
2answers
175 views

Multiply integrand with -1, and the precision changes?

"After multiplying the integrand of NIntegrate with -1, the Precision of the output will ...
6
votes
2answers
333 views

Inverse Laplace transform

Let $r=\mu = 0.15; \sigma = 0.05; T = 1; S_0 = 100; K = 95;$ Let $\nu:=\frac{2\mu}{\sigma^2}-1$ and $\eta \equiv\eta(\alpha):=-\frac{\nu}{2}+\frac{1}{2}\sqrt{\nu^2+\frac{8\alpha}{\sigma^2}}$. ...
6
votes
2answers
503 views

A problem about fixed point iteration theory

Description Recently, I have been learning a couse called "Numerical Analysis". The fixed point iteration theory was introducted to solve the ...
5
votes
1answer
104 views

Compilation, square roots, and integers

After looking at this question, particularly this answer, I wrote my own performance test, using the two functions ...
5
votes
3answers
1k views

Solution for equation system with piece-wise defined functions

As I could swear this worked just yesterday, I am probably just doing something stupid here and I am sorry to bother you :) I am trying to find the point where a curve crosses a line. In this case, ...
4
votes
1answer
255 views

Find lengths of contours in a ContourPlot

I am trying to find the lengths of different contours in the following plot: It is a complicated piecewise function evaluated on the unit disk. I am hoping there is an easy, generalized way to ...
3
votes
1answer
216 views

Why to do parentheses change the results of a calculation?

I'm getting results that are sensitive to where I place parentheses with respect to operations that are associative1 (and should thus be insensitive to such placement). For example, if I define2 <...
3
votes
3answers
155 views

Smooth initial data

I need something that produce pseudorandom smooth initial data for modelling phase separation equations (Cahn-Hilliard and simular). Generator code for now: ...
3
votes
1answer
346 views

Strange behaviour of PolyLog Function

I discovered some strange behaviour of the PolyLog[] Function in Mathematica which seems to me like a bug in the function implementation. It looks like ...
3
votes
1answer
326 views

Fixed-Point Numbers in Mathematica

I am working with a library that needs input in a Fixed Point notation. I’d like to figure out a way to convert the floating point results into fixed point representation. The fixed point length is ...
2
votes
2answers
402 views

Can Mathematica identify formulae or sequences of numbers?

Can Mathematica suggest what a formula means? For example if I input $$\sum_{i=0}^n i$$ can it infer that this is a sum of integer values from $0$ to $n$? Or if I enter $0,1,1,2,3,5,8,13$, can ...
2
votes
1answer
413 views

Area between Contours in ContourPlot

I feel slightly foolish for asking this because I am so close, but I'm having trouble, so I will anyway. I asked this question two days ago regarding finding the lengths of contours. Now, I'd like to ...
2
votes
2answers
330 views

How do I feed data points into an equation to solve NUMERICALLY?

I start with this equation and solve it numerically for $z(x,y)$ in the range $1 < x < 5$ and $1 < y < 5$: $$ \frac{3}{xyz} - 2x - 3y - 5z = 0 $$ Then using the data points of $z$ above, ...
16
votes
2answers
280 views

More efficient method to compute moments of the Johnson $S_B$ distribution

Here is a very specific feature request. I need Mean[JohnsonDistribution["SB", γ, δ, 0, 1]] When I issue e.g. ...
8
votes
1answer
699 views

Is there any automatic differentiation package?

I'm wondering if an automatic differentiation package exists for Mathematica. This is what I mean by automatic differentiation.
8
votes
1answer
221 views

Numerical Integration different in Mathematica version 9 and 10 with same options

I have noted that the same function with the same settings gives me different results in Mathematica version 9 and 10. This involves integrating numerically interpolating functions and so on. Here a ...
7
votes
2answers
363 views

listplot very large numbers

Suppose we have the following function: NN = 150; W[n1_] := NN!/(n1 ! (NN - n1!)) (1/2)^n1 (1/2)^(NN - n1) Then we can Plot or Listplot it: ...
6
votes
2answers
287 views

How to implement a numerically efficient Airy Zeta Function

Define the Airy zeta function for $n=2,3,\dots$, by $$ Z(n) := \sum_r \frac{1}{r^n}. $$ where the sum is over the zeros $r$ of the Airy function $\operatorname{Ai}$. In Mathematica the $\operatorname{...
6
votes
1answer
217 views

Numerical error in Mathieu functions

Consider the MathieuCharacteristicA function, which is a piecewise function according to the documentation. The discontinuity happens at integer number. ...
5
votes
2answers
146 views

Display All Output Numbers in HEX

How might I modify Mathematica such that I can get the following functionality when working with HEX values. The odd lines are input and the even output. Red values should be the HEX values. ...
5
votes
3answers
305 views

Increasing the precision of a calculation

Clearly I have misunderstood how to do this: I seem unable to understand how to get more digits out of a calculation and I can't see why - the following piece of code illustrates the issue. ...
5
votes
2answers
262 views

Strange phenomenon occurring in analytic integration result involving Bessel functions

For the following integral, Integrate[x^2 Exp[-a x^2 - b x^4], {x, -∞, ∞}, Assumptions -> {a > 0, b > 0}] Mathematica gives the following analytic ...
5
votes
2answers
1k views

Can the CholeskyDecomposition function in Mathematica be made to work on non-symmetric matrices?

The CholeskyDecomposition[m] function in Mathematica requires a symmetric and positive definite matrix m. For instance, the ...
5
votes
0answers
64 views

How to pass a custom method to a particular option?

In an answer to my question More efficient method to compute moments of the Johnson $S_B$ distribution, J. M. has come up with a method to compute the moments of the Johnson $S_B$ distribution, which ...
5
votes
3answers
245 views

Finding the conditions for degenerate solutions to a cubic equation

I have a cubic equation (corresponding to the band structure of a physical system) given by w in the code below. ...
5
votes
3answers
136 views

Differentiate a numerically defined function

My function is f[a_, b_] := NIntegrate[Sqrt[(Cos[t] - a)^2 + b^2], {t, 0, Pi}] I want to calculate g[1,1] where ...
4
votes
2answers
80 views

Is there a way for accuracy backtick notation to accept variable inputs?

Backtick notation uses 1.0``20 to give 1 with 20 places of accuracy after the decimal point. But what I want is ...
4
votes
4answers
279 views

First digit difference between two numbers

I was trying to build a function that finds the first decimal place difference between two decimal numbers of same sign. An example: ...
4
votes
2answers
498 views

Quickly reducing the number of decimal digits for a set of real numbers

How can I quickly convert a number with $n$ decimal points to a number of with $m$ decimal points? Round works, however, it is slower than I would like. This ...
4
votes
2answers
262 views

Numerical sum does not give consistent results

Consider the function ...
4
votes
1answer
195 views

Minimize failing on a polynomial

Calling: Minimize[{-0.4877 - 0.1190 r^2 - 0.1885 r^4 + 2.9703 z - 0.5531 z^2, 0 <= z <= 3.5 ∧ 0 <= r <= 1.75}, {r, z}] returns ...
3
votes
1answer
48 views

How shortening argument test when declaring functions?

When defining some functions which depend in many arguments sometimes we need to include question Q constraints to diminish processing time. My question is simple, there is a way to shorten a long ...
3
votes
3answers
2k views

Implementing Newton's method

I have this question on coding Newton's method in Mathematica. I have some code to go by but I have no clue if it's computing the functions in the right order. The book is the numerical methods ...
3
votes
1answer
237 views

Breaking out of NDSolve

I am solving a coupled set of differential equations with NDSolve for 6 unknown functions of time. At a certain point in time, the system hits a singular point ...
3
votes
2answers
161 views

Plotting Planck's function and unexpected results

I have the code below. If you look at the plot, you can see a strange behaviour. The function goes to zero as λ->0 but you can see the plateau below ...
3
votes
1answer
144 views

obtaining real roots of negative numbers in a long expression [duplicate]

I have a complicated symbolic expression which contains many terms like $(a/(a-2))^{1/m}$, where $a/(a-2)$ could be positive or negative after replacement. I only need the real root after ...
3
votes
1answer
100 views

Understanding difference between `NIntegrate` result and home-cooked Simpson's rule

In this question I am asking about the different results I get between NIntegrate-ing a function of two variables vs. "doing it myself" with my own implementation ...
3
votes
1answer
586 views

Animated Wave Propagation using Fourier & InverseFourier

This is a continuation off of previous help on the first part of my project: fourier issue arising from input miscommunication Now I want to go one step further in the current code. Here's the code ...
2
votes
1answer
234 views

Fourier Transform Help

I'm trying to do a Fourier Transform of the following Data, but I'm completely stuck. Here's what I've done so far: ...
2
votes
2answers
266 views

Steady State Numerical Solution of Heat Diffusion Equation in 2D

I'v been trying to solve for the steady state of the heat diffusion equation numerically but I cant seem to get it to work. My code is ...
2
votes
1answer
289 views

Numerical comparisons of matrices

I have a matrix which should be equal to a null matrix. However due to the numerical precision, a brutal equality test with a matrix initialized with zeros does not work. How should I perform the ...
1
vote
1answer
85 views

Numerically solving a transcendental equation as a series

Given a transcendental equation $f(x,y)=0$, is there a way for Mathematica to automatically solve the equation as a series? I already know that I can use ...
1
vote
1answer
110 views

How can I increase the precision of my computation?

How can I increase precision up to 15 digits for the results (EC, and that of FindRoot) computed below? ...
1
vote
1answer
144 views

Why does it matter at what point I replace?

I need to find four orthogonal linear combinations of complicated functions, that vanish at four different points. I use (LK4 is defined below, but its shape should have nothing to do with my problem)...
1
vote
1answer
811 views

Trying to solve a transcendental equation involving Bessel functions

I've never used Mathematica before and am trying to numerically solve equation (12) from this paper. Ideally I'd be able to find the smallest value of $x_{n\nu}$ for $\exp(-kr\pi)$ close to 1, and ...