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

learn more… | top users | synonyms (1)

9
votes
1answer
116 views

Does Mathematica have an equivalent of C's nextafter?

In C (and many other programming languages), there is a function double nextafter(double x, double y) which takes two (IEEE 754) floating-point numbers and ...
1
vote
0answers
47 views

How to incorporate the boundary conditions into the differentiation scheme in MMA?

Let that we want to numerically solve the following PDE \begin{equation}\label{sde} -r V(S,t)+r S \frac{\partial V(S,t)}{\partial S}+0.5 S^2 \text{sigma}^2 \frac{\partial ^2V(S,t)}{\partial ...
0
votes
0answers
38 views

CharacteristicPolynomial returns 0

I have the following matrix. ...
0
votes
0answers
38 views

Solve an integral equation: to fit the given data with an integral of two functions?

I am trying to find an efficient way to solve the following equation $$h\left(b\right)=\int_{0}^{b}f\left(\frac{b-c}{1-c}\right)\frac{g\left(c\right)}{1-c}dc$$ where for $h(b)$ I have the data ...
0
votes
2answers
68 views

Plot ParametricNDSolve

I am trying to plot the probability of a molecule being in a certain state via the numerical solution of the Schrödinger's equation of molecule in an oscillating electric field (in a rotating system). ...
-3
votes
0answers
43 views

Problem with Integration [closed]

I have a problem with numerical integration of this function. Is there any way for this calculation? ...
1
vote
1answer
74 views

Is it possible to solve a certain set of nonlinear equations in Mathematica?

I read this question in a Chinese forum last year. At the end of the discussion, they provide a solution of the equations from a C++ program. Unfortunately, they did not get the right answer. ...
0
votes
1answer
56 views

NDSolve issue with initial and boundary conditions

While solving the heat equation in one spatial variable $u_t = u_{xx} $ (x goes from 0 to L) with the initial temperature distribution $T_0 \frac{x(L-x)}{L^2}$ , and with neumann boundary conditions ...
0
votes
0answers
41 views

Finding common roots to several functions

I am trying to solve the following problem. Given $a\in\mathbb R^n$, $u\in\mathbb{R}^n$, $m\in\mathbb{N}^\star$, Find the/some common roots $(t_1,...,t_m)$ of the $\frac{m(m-1)}{2}$ ...
0
votes
1answer
45 views

NDSolve::bcsol?

I'm writing a code to numerically solve a differential equation. It has to repeat the process several times since there is a variable involved which is unknown, and the equation is fit to some ...
0
votes
1answer
54 views

Problem with Erf near Infinity in NSolve

I have to solve a differential equation involving the error function Erf, but my code is not able to evaluate it in the range I need. I think I can formulate my ...
0
votes
0answers
42 views

BVP Non Linear Shooting Method Implementation

I've been working on this problem for several days. I want to split a 2nd order ode bvp into two auxillary ivps and use those to approximate the solution to the bvp. I have managed to get one ...
15
votes
0answers
160 views

Is MathieuC for moderately large imaginary arguments broken?

I'm trying to plot MathieuC[-3,0.3,I x] for $x\in[0,10]$, and here's what I get even with arbitrary precision arithmetic (here I use ...
1
vote
1answer
137 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 ...
6
votes
0answers
55 views

Negative accuracy numerics ( 0``-128 notation )

What does it mean to have a negative accuracy number? I understand 0``128 to mean "the number zero to 128 decimal points". Mathematica corroborates this: ...
2
votes
0answers
69 views

Problem solving a nonlinear partial differential diffusion equation [closed]

EDIT: actualy the nonlinear partial differential equations for interacting density distributions, including boundary conditions, should be given as $$ \frac{\partial\phi}{\partial t} = D ...
5
votes
2answers
102 views

A problem with Compile and Map

There is a weird behavior of Compile that I do not understand. Consider the following example: ...
9
votes
3answers
4k views

Does Mathematica get Pi wrong?

I happened to watch a Youtube video on Pi. According to the video, the 1 millionth digit of Pi is 1. And here is another page of the first 1 million digits of Pi. You can get the same answer from ...
0
votes
1answer
59 views

usage of random numbers in recursive loop

I am trying to evalute two functions using iterative process as below ...
2
votes
0answers
50 views

How to speed up solution of system of recurrence equations

I was wondering how I can improve the speed on this method for solving a particular system of coupled recurrence equations. The system is $$ \begin{align*} &V(m)=\alpha + \beta V(m+1)+\beta ...
-2
votes
1answer
55 views

How to generate normally distributed random number [closed]

I want to sample or return random number from a distribution which is normally distributed with mean of zero and standard deviation of 1. I am using RandomReal[NormalDistribution[0, 1]] I s this ...
-2
votes
1answer
93 views

Why does Mathematica “sleep” when I don't work at computer? [closed]

I started using Mathematica few days ago. I'm running this code: ...
0
votes
1answer
63 views

numerically solving

I am trying to solve for [Lambda] as a function of a (unknown) from this expression ...
0
votes
0answers
37 views

Second derivative using ND [duplicate]

I have a function g=f(x,t). The function "g" came from a numerical integration: g[x_?NumericQ,t_?NumericQ]:=NIntegrate[tt[x,r,t],{r,rmin,rmax}] and tt(x,r,t) ...
2
votes
1answer
62 views

Imaginary terms in the derivative of Jacobi theta function (2) on the real line

I am trying to calculate/plot the derivative of the second Jacobi theta function $d\theta_2(0, e^{-\pi t} )/dt$. Calculating or plotting the function itself works fine: ...
2
votes
0answers
33 views

How do I numerically integrate over a data set that has uncertainties? [closed]

I have a 1D data set {xi, yi} with no uncertainties in xi and with uncertainties dyi in yi. The resulting discrete function is monotonic and relatively smooth and I would like to integrate the ...
3
votes
1answer
93 views

compute the gradient in high dimension

The following code is used to compute the gradient of a given 2D data. ...
3
votes
1answer
81 views

Why is the Spherical Bessel Function acting strangely at this point?

I'm doing some computation that requires the use of Spherical Bessel Functions of the 1st kind, at high orders and values. So, I managed to find this, while running it over a wide range of values. I ...
0
votes
0answers
41 views

Integro differential eq boundary difficulties

I'm trying numericaly solve simple integro-differential equation, but have some problems with boundary conditions. System: ...
0
votes
1answer
62 views

Why does Compile redo the calculation when overflow happens?

When implementing the Numerov method solving Schrodinger equation, I encountered this problem. In order to show the order of the evaluation, Print is added. ...
0
votes
1answer
97 views

How to adjust excel data for NonlinearModelFit?

I'm really new to Mathematica and I'm facing a problem and would really appreciate some help! Maybe my question is similar to one described in How to fit 3 data sets to a model of 4 differential ...
0
votes
0answers
29 views

How to use FindFit to find the parameter in Laplace space(numerically inverting Laplace transforms)

I am trying to find the parameter in Laplace space, and a very simple example is shown below: I have known the solution $y_{laplace}$ in the laplace space is $a/s^2$, and I also have some discrete ...
0
votes
2answers
97 views

Numerical 3D Integration in Mathematica [closed]

My question in short is: Is it possible to make numerical 3D integration in mathematica efficiently? Or am I gonna have to move this to C++? I feel this problem is way too trivial to go to C++, so ...
0
votes
0answers
58 views

Optimising prime number test code

Is it possible to speed-up this code ? Also, It would be great if people could test this algorithm. I only have a Raspberry Pi to test it on, so I can't be certain it's not a strong probable prime ...
0
votes
2answers
113 views

Compute expectation numerically

I want to compute this expectation numerically with Mathematica. I could not figure out how to solve it numerically. Could you please help me? $$E(x|p)=\sum _{i=0}^m \sum _{j=0}^m ...
1
vote
1answer
110 views

Poisson PDE in a rectangular domain

I found a solution for this problem, but this is in Scilab and I never use Scilab. Can anyone can help me to translate it in Mathematica? Here is the Link:http://imechanica.org/files/TorqueR.pdf I ...
0
votes
0answers
37 views

numerical integration with parameter

Now I'm trying to integrate a function numerically. But it shows always an error message. x=y is not a valid limit of integration I know that this function ...
3
votes
1answer
99 views

Define and refine mesh around a hole

I am solving Laplace equation with particular geometry and boundary conditions: ...
0
votes
1answer
79 views

Floating point arithmetic bug caused by Table[]

I was doing something fairly ordinary and noticed something I can't, for the life of me, explain. For context, I wanted to take make a function that takes an array of data like the one below, then an ...
4
votes
2answers
173 views

NDSolve in Mathematica won't use all the cores avaiable

When I solve a system of differential equations in Matlab, the task manager shows that all the CPU cores are in use. This is not true when I solve the same system in Mathematica. I have six cores. ...
0
votes
0answers
47 views

Any way of solving this system of nonlinear equations with non integer powers?

I have a system of four nonlinear equations. Some of the exponents are fractions. I was wondering if this is what is causing NSolve to run for hours without giving ...
4
votes
4answers
275 views

Spiral roots, how?

I found this picture on the net, as I can play in mathematica
1
vote
1answer
36 views

Implicit region is not “valid” in ParamatricNDSolveValue function?

I am trying to solve a geometric problem with relation to my Schrodinger equation and its boundaries. Here is my code: ...
1
vote
1answer
48 views

Determine whether one value is divisible by another [closed]

How do I determine whether one number is evenly divisible by another in the case of large numbers, for example: 52^52 / 52!
1
vote
1answer
71 views
2
votes
2answers
135 views

NIntegrate over a list of functions

This question is the result of these other two questions. Question 1 and 2. I thought it would be better to ask a new question rather than deleting previous one. I think When ...
0
votes
1answer
73 views

Numerical integration and plotting

New to Mathematica, and trying to numerically evaluate two integrals: ...
2
votes
2answers
156 views

Entropy of the elements of a general data set

I have the following data set, and wish to track the evolution of the entropy of each element within the set. I have evaluated the entropy for some elements, but how does one evaluate the entropy of ...
1
vote
1answer
108 views

Quantum Physics question [closed]

I'm not sure if anyone here would be able to help me. But if you know a more appropriate place where I could ask for help, please let me know. So here's the question: And here's my attempt at ...