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

learn more… | top users | synonyms (1)

-2
votes
1answer
75 views

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

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

How to generate normally distributed random number [on hold]

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
2answers
106 views

WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
4
votes
4answers
263 views

Spiral roots, how?

I found this picture on the net, as I can play in mathematica
0
votes
1answer
61 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) ...
1
vote
1answer
42 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
30 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
81 views

compute the gradient in high dimension

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

Why are numeric division and subtraction not handled better in Mathematica?

There is something that has been troubling me for a while. At least through version 10.0 the performance of a / b and a - b is ...
0
votes
0answers
39 views

Integro differential eq boundary difficulties

I'm trying numericaly solve simple integro-differential equation, but have some problems with boundary conditions. System: ...
14
votes
2answers
171 views

CompiledFunction returns machine numbers smaller than $MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
0
votes
1answer
58 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
85 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 ...
-1
votes
0answers
24 views

How could I speed up a code including a Module with many functions

I have implemented a big formula through the mathematica function Module. Within this module a lot of definitions are made (i.e. function[x_]:=). The code are working well but it is too slow. I am ...
10
votes
4answers
3k views

How can I differentiate Numerically?

Mathematica has two ways to integrate: Integrate and NIntegrate. But what about D? ...
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
86 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 ...
24
votes
2answers
893 views

Funny behaviour when plotting a polynomial of high degree and large coefficients

I am trying to plot a polynomial of degree 29 on the domain [0,1], with fairly large coefficients: ...
36
votes
6answers
6k views

Finding real roots of negative numbers (for example, $\sqrt[3]{-8}$)

Say I want to quickly calculate $\sqrt[3]{-8}$, to which the most obvious solution is $-2$. When I input $\sqrt[3]{-8}$ or Power[-8, 3^-1], Mathematica gives the ...
0
votes
0answers
57 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
109 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 ...
26
votes
1answer
835 views

Fast Spherical Harmonics radiative transfer

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...
1
vote
1answer
81 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 ...
10
votes
1answer
580 views

Why can't I change the value of MaxRecursion in NIntegrate when integrating BesselJ?

Bug introduced in 8.0.4 or earlier and persists through 10.0.2. I am trying to evaluate this integral numerically $$ \int_0^{\infty } J_0(q R) \tanh(q) \, \mathrm{d}q $$ for large values of $R$. ...
1
vote
1answer
101 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
31 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
2answers
153 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. ...
3
votes
1answer
90 views

Define and refine mesh around a hole

I am solving Laplace equation with particular geometry and boundary conditions: ...
2
votes
2answers
221 views

How to solve this numerically?

May I ask what is the best way to evaluate ...
0
votes
1answer
77 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 ...
0
votes
0answers
44 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 ...
10
votes
1answer
380 views

Symbolic Integration along contour: branch cut problem?

Context Following this question on path integrals in the complex plane, having defined again a numerical and symbolic integrator along a path as ...
0
votes
1answer
135 views

How can I obtain more significant digits? [duplicate]

I type f1[x_] := 12 x^5 - 975 x^4 + 28000 x^3 - 345000 x^2 + 1800000 x N[f1[15.5], 15] and obtain 3.74112*10^6 BUT It´s not true!!! the result is larger than ...
1
vote
1answer
35 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: ...
0
votes
1answer
72 views

How to obtain a convergent solution iteratively for a linear system of equations

I am working on a problem that requires an iterative procedure to solve a linear system of equations, the system of equations in matrix form is: $$\underbrace{\begin{bmatrix} r_{11} & r_{12} ...
1
vote
1answer
46 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
140 views

Slow evaluation of NIntegrate when used as a pure function

I asked a perhaps related question here. Here is my code in below. The goal is that to define a function which must be integrated numerically. The function itself first is calculated over different ...
0
votes
1answer
70 views

Numerical integration and plotting

New to Mathematica, and trying to numerically evaluate two integrals: ...
4
votes
4answers
148 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: ...
2
votes
2answers
154 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
102 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 ...
3
votes
1answer
82 views

Why is left NumberPadding always applied in NumberForm?

I would like to display numbers like 9.0001 and 10.0001 in the fixed-width form of xx.xxxx. ...
0
votes
0answers
35 views

real eigenvalues, imaginary eigenvectors

Solving the most basic eigenvalue problem, the 1d Schrodinger equation in Mathematica can be tackled either through a ParametricNDSolveValue (which I don't like) or implementing a full numerical ...
2
votes
1answer
69 views
2
votes
3answers
146 views

Plot a bunch of lines in 3D from point data

I have a 12*25 array, wherein each entry is of the form $\{x,y,z\}$. So 12 different $x$ values, 25 different $y$ values and 12*15 $z$ values in all. I'd like to plot 12 curves of various $x$ values ...
1
vote
1answer
87 views

The problem (time) caused by ?NumericQ

In here, I asked a related (similar) question. Using ?NumericQ seems have slowed down the entire calculation. But I now have a more serious problem: ...
0
votes
0answers
36 views

NDSolve dependence on initial values

I'm checking some results in this paper and I'm currently having some issues with a numerical integration of a set of differential equations using NDSolve (section 2 and 3.1-3.2 in the paper). I'll ...