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

learn more… | top users | synonyms (1)

1
vote
1answer
144 views

Seemingly simple optimization problem is slow

I'm trying to generate a demand curve numerically, given a utility function. The function for the demand is defined like so: ...
2
votes
1answer
175 views

Computing derivatives of a moment generating function

Dear Mathematica users, I'm trying to compute higher order derivatives of a moment generating function and then evalutate them in 0 (in order to get some moment conditions for a GMM estimation). ...
8
votes
2answers
362 views

Precision differences

I run this sum and get the symbolic answer below : Sum[ (1/(k^2 - k) - 1/k^2), {k, 2, Infinity}] $2 - \frac{\pi^2}{6}$ I look up the sequence on OEIS and ...
13
votes
3answers
342 views

Make mathematica treat $e_i^2$ as numeric

With NumericQ[symbol] = True, I can declare that a symbol is numeric. I want the expressions matching: $$e_{\text{i$\_$}?\text{IntegerQ}}^2$$ to be treated as ...
5
votes
1answer
228 views

FindMaxValue specifics

I'm using FindMaxValue to study the distribution of maxima of Abs[RiemannSiegelZ[t]] between consecutive values of ...
0
votes
1answer
111 views

Non solutions returned by NSolve. And why does it return both phi and Cos[phi]?

Similarly to this thread NSolve gives additional solutions that don't satisfy the equations! NSolve returns "spurious" solutions, even increasing the working precision ...
4
votes
1answer
206 views

How to solve this trigonometric system of equations numerically?

How can the following trigonometric system of equations be solved numerically? ...
1
vote
1answer
206 views

Why does NSum fail here?

I want to evaluate a sum of integrals; each integral has a pole on the real axis and I handle this via the Cauchy Principal Value $ ...
2
votes
0answers
344 views

Numerically/Analytically Solving a System of Equations

I have $6$ functions $f_i(x,y,z)$, $(i = 1, \ldots, 6)$ in three variables $x,y,z$, and I would like to find a simultaneous instance of these variables, say $(x_0, y_0, z_0)$, such that $f_i(x_0, y_0, ...
8
votes
2answers
2k views

How do you force a decimal output? [duplicate]

I have some very small values such as 2.601519253*10^-8. I'd like to output these values to CSV for another program to work with. I've tried N[value, 50], but Mathematica still insists on producing ...
2
votes
2answers
227 views

Position function not always retuning an answer even with no apparent problems

I'm having some problems with Position. Sometimes it will give an empty list instead of the actual position of the element I am looking for when that element is ...
3
votes
3answers
587 views

How can I solve Tan[t] - t == F[x] for t as a function of x?

How can I solve the equation Tan[t] - t = Ax, where A is a constant for t[x]? I know that ...
4
votes
2answers
380 views

Any ideas on how GeneralMiniMaxApproximation is implemented?

GeneralMiniMaxApproximation is used to construct minimax approximations of parametrically defined functions. I am curious about how ...
1
vote
1answer
190 views
0
votes
1answer
140 views

Industrial Level Applications. Recipe for mixed notation of equations set

I am working with large (linear) equations set within Mathematica in numerical notation. For example, set from 4056 eq. is solved for a second, no more. There is no doubt, result is great. But even ...
4
votes
1answer
192 views

How do I get a list of digits for a number?

I have this 200 digit number where I want to get the IntegerDigits, but the decimal point is in the way. ...
1
vote
0answers
171 views

Parallel linear algebra with arbitrary precision

Is it possible to do parallel linear algebra with arbitrary precision within Mathematica (in a simple manner, as is done for the machine precision)?
3
votes
2answers
254 views

Numerically finding a derivative jump of a function

How would I numerically find where a function has derivative jumps? In particular, I'm working with this function: ...
0
votes
1answer
1k views

Tricks for solving (lots of) coupled nonlinear equations numerically?

I have a system of 6 non-linear (quadratic) coupled equations with 6 complex unknowns \begin{align*} |x_1|^2 + |x_2|^2 + |x_3|^2 &= a\\ x_1 x_4^* + x_3 x_5^* &= b + c i\\ x_1 ...
10
votes
2answers
327 views

Determining the default Method used in optimization and root-finding algorithms

Is it possible to extract the Method which is used in functions like NMinimize, FindRoot, ...
4
votes
1answer
280 views

Is there a way to globally set when to treat a very small number as zero?

I understand that I can use Chop to force a very small number to be treated as 0 and can use ...
4
votes
1answer
188 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 ...
2
votes
2answers
356 views

Plotting several numerical solutions plus the analytic solution of ODE in one plot

I want to be able to plot several numerical solutions of an ODE plus its analytical solution in one plot in order to see how the numerical solutions converge towards the analytical one w.r.t. the ...
9
votes
3answers
2k views

How can I differentiate Numerically?

Mathematica has two ways to integrate: Integrate and NIntegrate. But what about D? ...
0
votes
1answer
241 views

How do I numerically solve a custom function?

Whenever I use functions like FindRoot or NDSolve, it sends x through the function and deals ...
8
votes
1answer
322 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 ...
16
votes
2answers
755 views

How to compute the inverse CDF properly?

Note: this has been fixed in version 9. I want to compute the CDF and inverse CDF of the hyperbolic distribution: ...
5
votes
2answers
532 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 ...
9
votes
0answers
501 views

Dual complex integral over implicit path using contour plot

Context I am interested in doing double contour integral over paths which are defined implicitely. For the sake of debugging, let's assume its $$\oint_{\cal C}\oint_{\cal C} \frac{1}{u\, x} d u d x$$ ...
4
votes
1answer
713 views

Symbolic integration in the complex plane

Context While answering this question, I defined (symbolic and numerical) path integrations as follows ...
3
votes
0answers
364 views

Numerically solving PDE with high precision

I want to numerically solve the PDE $\partial_t u(t,x)=c\partial_x u(t,x)+(mx-l)u(t,x)$ with some initial and boundary conditions and given parameters $c$, $m$ and $l$. Consider the code ...
7
votes
1answer
819 views

Is Abs[z]^2 a bad way to calculate the square modulus of z?

For a numerical quantity z, Abs[z] returns the square root of the sum of the squares of the real and imaginary parts of ...
7
votes
1answer
804 views

Implementation of Incomplete Fermi-Dirac Integral in Mathematica

I'm working on a special algorithm to implement a more accurate effective mass calculation for hole carriers in silicon in Mathematica. This rather involved algorithm uses incomplete Fermi-Dirac ...
9
votes
1answer
198 views

RandomReal closed on left & open on right?

I have a number of algorithms that depend on uniform random reals in half-open intervals such as $[0,1)$. In particular, I need a (pseudo) random-number generator that produces machine-precision ...
3
votes
1answer
197 views

Construct DifferentialMatrices and Kernel for LevinRule for this integral and ODE set

I've made a lot of progress on my problem the last few days thanks to all the help I've received on here. I think I'm upto the final step of greatly improving the performance of NIntegrate[..] on my ...
4
votes
1answer
719 views

Mathematica NDSolve and 'Compile'?

Since the consensus is usually that NDSolve speeds fares badly against compiled code such as c++ ODE solvers using GSL say, is it possible to make up for this lag ...
12
votes
2answers
400 views

Preventing Numerical value from being evaluated

I have searched stackoverflow (and comparable pages) for quite a while now (got redirected from there to this specialized stack), and I surrender. I am trying to evaluate an expression that is small ...
1
vote
1answer
291 views

Why is NDSolve solving in term of two 1st order ODE slower than 2nd order?

As mentioned in the documentation for NDSolve it's often convenient to reduce a 2nd order ODE to a system of first order equations. When I do this however I seem to see a significant speed reduction ...
2
votes
1answer
609 views

NDSolve runs out of memory

I need to solve a second order ODE numerically. The ODE depends on two parameters (a,b). Things work fine when 'a' is small, but for large 'a' the solutions are oscillating rapidly and Mathematica ...
0
votes
1answer
340 views

How to build a grid of integrand points and numerically integrate?

If I have some function I know numerically only, say f(x) and each point $x$ takes significant time to compute so I have them all stored in some file as f(1)=0.232423, f(1.1)=0.3243432,....Then is it ...
10
votes
3answers
2k views

NDSolve with Euler method

I want to solve this equation with NDSolve[] using the Euler method: x'[t] == 0.5*x[t]-0.04*(x[t])^2 with initial condition ...
14
votes
1answer
1k views

Poisson solver using Mathematica

I am looking for some help with a Poisson solver I am writing in Mathematica. The code is quite long with Arrays plugged in, so the full details can be found at http://pastebin.com/uSrSDcW6 I am ...
2
votes
1answer
191 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
2answers
102 views

NSum generates a warning message when getting the sum of a list

I know what I'm doing can be done with Total: a = Range@3; Total@a And if I simply choose ...
10
votes
1answer
808 views

How do I find all the solutions of three simultaneous equations within a given box?

Sometimes, one needs to find all the solutions of three simultaneous nonlinear equations in three unknowns $$\begin{align*}f(x,y,z)&=0\\g(x,y,z)&=0\\h(x,y,z)&=0\end{align*}$$ within a ...
15
votes
3answers
728 views

Can Mathematica Handle Open Intervals? Interval complements?

Open Intervals Following up on this question, I was wondering whether Mma can handle open intervals. For example, the union of the intervals, $$1<x<5$$ and $$5<x<8$$ should not ...
2
votes
1answer
384 views

How to solve simultaneous equations faster with Compile?

I have large 6x6 matrix Uwhich is a multiplication of 15 rotational matrix. All of the elements are Sin\[theta] and ...
4
votes
1answer
572 views

How can I get Mathematica to allow me to apply FindRoot to an expression that contains NIntegrate?

I am trying to run the following command in Mathematica: FindRoot[NIntegrate[D[f[x], x] / Sqrt[1 - x^2], {x, 0, 1}] - d, {a, 245}] As you might expect, a is ...
1
vote
3answers
353 views

equation solving problems

I have some equation: $$ veq=-2-lr-l^2r+2(r+ir^3\omega) v' + (-2+r)r^2v'^2 + (-2+r) r^2 v''==0 $$ or in Mathematica form: ...
8
votes
1answer
301 views

ReplaceAll[] and Limit[] don't give correct results for this expression under extreme variables [duplicate]

Possible Duplicate: Funny behaviour when plotting a polynomial of high degree and large coefficients 1/x^2 + (3 + x)/(6 (1 - Exp[x] + x)) ——This is a ...