Questions tagged [numerical-value]

Question relating numerical representations, operations and methods, including approximate results instead of exact symbolic results.

Filter by
Sorted by
Tagged with
34
votes
2answers
731 views

GroupBy twice gives different results

Bug introduced in 7.0 or earlier and persisting through 11.1 It took me quite a lot of time to finally trace down to this strange output. I really don't know why. First, I create a list ...
18
votes
2answers
678 views

Error and uncertainty propagation: Is using Precision/Accuracy a sound strategy?

Questions What are the available resources to deal with experimental error and uncertainty propagation in Mathematica? Given that Mathematica already uses linearized model of error propagation on ...
11
votes
3answers
995 views

Solve Laplace equation in Cylindrical - Polar Coordinates

Hey mathematica stackexchange!! I've got a (possibly stupid) problem. I've tried many things to no avail, and I've read every post I've found on Laplace's equation. Background: I'm trying to find the ...
10
votes
3answers
700 views

What is the fastest way to compute digits of $\pi$ using Mathematica?

There are a lot of ways to calculate digits of $\pi$ using Mathematica. The most naïve way I can think of is N[π, 100000000] Of course, there are a lot of fast ...
9
votes
2answers
511 views

Matching pair of numbers {a,-a}, where a is numeric

Imagine you have a list of pairs of numbers, such as {{2,-2}, {1,5}, {1,-3},{-3,3}} The task is to reduce the given list to a list of pairs of type ...
8
votes
5answers
2k views

Numerical voodoo in mathematica? [closed]

So, I was doing some calculations in Mathematica, and came across the following paradox! (I may be exaggerating, but...) I wanted to solve the following equation: $3.33333*10^{-15} - 3.33333*10^{-15} ...
8
votes
2answers
3k views

Could I define 0^0 to be 1? [duplicate]

Many occasions, where I need to work numerically with functions. For a variable strictly between 0 and 1, during the optimization, it could become 0.^0 or 0^0, which then become indeterminate. Is ...
8
votes
2answers
292 views

Why does N[Re@f] give complex result?

Consider this code: ...
7
votes
2answers
229 views

how to get single, and quad Precision out of Mathematica which match Fortran result

by default, if a number has decimal . after it, then Mathematica will do computation using machine Precision, which on my PC (intel hardware) running windows 7 64 ...
6
votes
4answers
126 views

Suppress trailing 0s in numerical values

For example, this is what I want In[1]:= N[Table[4^(i/4), {i, 1, 4}]] Out[1]= {1.41421, 2., 2.82843, 4.} But if I want a few more digits only from the irrational ...
6
votes
1answer
155 views

Machine precision infinity

Is it possible to obtain the machine precision (double) version of Infinity? This is useful when using LibraryLink and C ...
5
votes
3answers
231 views

How to plot output data of Do-command?

The following in a simple numerical solution of the simple harmonic oscillator. ...
5
votes
3answers
293 views

How to complete function which is not defined for all interval

I have a function testF22 like this ...
5
votes
0answers
244 views

How does NSolve find the roots to an equation?

I'm using NSolve to find the roots to a transcendental equation. For this, I need to specify a bounded region where roots are searched. What I want to know is how <...
4
votes
1answer
498 views

Recognize physical constants?

Is there some way to ask Mathematica to recognize physical constants, such as 32 or 9.81 (gravitational acceleration, in different units, at Earth's surface)? I have in mind something like the "...
4
votes
2answers
793 views

Why are my recursive functions running so slowly? And how do I fix them?

I am working with making numerical solvers for a modeling class I am in, and I want to use the internal recursion handling that is built into mathematcia, but there seems to be a problem. NDSolve ...
4
votes
1answer
330 views

DensityHistogram label/display values in Mathematica 8

I'm trying to make a DensityHistogram in Mathematica 8 that overlays the histogram values for each location. What I want is for the value of each square to be ...
4
votes
1answer
113 views

Why does this test yield True

I have this test implemented in my code, when I import a numeric matrix, which I thought would be bulletproof, but it's failing in this case: ...
4
votes
2answers
191 views

Torus-geometry algebraic equations using Nsolve and Reduce

Somehow a set of naive-looking equations cannot be solved by using NSolve. Mathematica returns a message like this: ...
4
votes
1answer
652 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 ...
4
votes
1answer
92 views

N[Product] and NProduct give different results

I have some trouble. I've been using finite product to study a certain function (see below). However, when I wanted to compute it precisely, I decided to use ...
3
votes
2answers
262 views

Visualizing the Schrödinger equation for dipole based interaction Hamiltonian

I want to evaluate and plot the solutions of coupled linear differential equations. For each time frame, I want to display the probability values (corresponding to mod square of these solutions), and ...
3
votes
2answers
164 views

NIntegrate on a solution of a matrix ODE

I've seen similar questions on this site but somehow the solutions there didn't manage to solve my specific problem. I have a function mat1 that takes a square $n \times n$ matrix G, and some final ...
3
votes
2answers
330 views

Creepy numerical artefacts of a closed-form solution

I'm wishing you a nice day and here is my problem: I tried to obtain relation between chemical potential and temperature in a semiconductor and I arrived at this equation: $$ 2 e^{-\Delta/kT} \left( ...
3
votes
2answers
133 views

Solving Equations with HeavisideTheta Functions

I need to solve an equation that involves the HeavisideTheta[] function, but regardless of the method I use Mathematica returns an error message. For example, <...
3
votes
1answer
94 views

Comparing exact expressions vs real numbers

Often I need to generate some data using some symmetry operations and I usually keep them as exact expressions (for example, consider the points on a triangular grid ...
3
votes
3answers
185 views

How to change random values in manipulate?

I made a Manipulate box that is working very well, using lots of random numbers. I would like to add a button to "reset" (i.e. to change, randomize, or reselect) all the random parameters. Here's ...
3
votes
1answer
129 views

How to avoid rounding error, when exporting numerical values

How to avoid the rounding error, when exporting data like this: ra = Range[0.004, 0.074, 0.0005]; Export["range.txt", ra] The result is this:
3
votes
1answer
145 views

Inverse prediction function

I am trying to write a code which learns a data set. Now, I want to know the input value for a given output value. Consider, the following code ...
3
votes
1answer
169 views
3
votes
1answer
58 views

Numerical precision problem

I have this simple code: ep = 1 - 80000000000 (-(199999/200000) + 1/E^(1/200000)) ep // N -8.27404*10^-8 ...
3
votes
2answers
447 views

Plot numerical solutions for a varying parameter

I would like to solve this equation $\log{\frac{a}{1 - a}} + b (1 - 2 a) = 0$ letting varying the parameter $b$ in $\lbrace 0,1,\ldots,20\rbrace$ and then plot the result. I am trying writing the ...
3
votes
2answers
121 views

Role of Accuracy in numerical evaluations, SplitBy vs GatherBy

This is a follow-up question to this question. I generated a list by substituting the results of a solve[] routine and set: ...
3
votes
1answer
92 views

Why does NSolve give different results in different version of Mathematica?

I am working on a problem with a colleague who uses Mathematica v.10.2 while I have v.11.0 Student Edition. We are solving the exact same equations but get two slightly different results. Why would ...
3
votes
1answer
88 views

Is this bifurcation or numerical error?

I encountered a definite integral (with parameter $k$) that produces the "chaotic" figures below. $$F(k) \equiv \int_{\theta_k}^{\theta_{k+1}} f(\theta, J \sin\theta - k)\,\mathrm{d}\theta~, \qquad f(...
3
votes
1answer
78 views

Numeric values for MinkowskiQuestionMark

Why NumericQ[MinkowskiQuestionMark[Pi]] returns False? Is it defined only for algebraics? Numerical evaluation gives some number,...
3
votes
1answer
115 views

Solve a system of 4-th order polynomial equations (numerically)

I have a function defined on $ S^6 \times S^6 $ (two spheres embedded in $ \mathbb{R}^7 $ individually). Let us call this vector $ \vec{f}(\vec{x},\vec{y}) $, where $ \vec{x} $ and $ \vec{y} $ are ...
3
votes
1answer
143 views

How to make Mathematica substitute exact numerical values of (derivatives) 2F1

I have a long output that contains Taylor expansion of some function. Some of the coefficients are combinations of the (derivatives of) 2F1 at nice integer values of the coefficients. I can see that ...
3
votes
1answer
251 views

Dealing with square roots [duplicate]

Consider following expression: $$ \sqrt{-\left(2 \sqrt{x^{-8/3}-x^{-4/3}+1}\, x^{4/3}+5\right) x^{4/3}+4 \sqrt{x^{-8/3}-x^{-4/3}+1}\, x^{4/3}+2 x^{8/3}+5} $$ In code: ...
3
votes
0answers
168 views

On Ж, and the fine-structure constant

I'm trying to reproduce the results from a certain infamous paper that has been moving around the web for the last few days. The details are irrelevant. This paper claims to have a closed-form ...
3
votes
0answers
47 views

Is there a function that returns me the largest common divisor? [closed]

Is there a function that returns me the largest common divisor? I tried this: Intersection[Divisors[200], Divisors[280]] // Last
2
votes
3answers
293 views

N[…, 5] does not returns what I expected

I have this ...
2
votes
3answers
434 views

Re-arranging / selecting of a data table very slow in For loop [duplicate]

My task is quite simple; I have a table of data like M = {{1,2}, {1,3}, {3,4}, {5,1}, {6,9}, {6,8}, {6,1}}; so the table is sorted with respect to the first ...
2
votes
2answers
202 views

Help for Solving Two Equations For Two Unknows (from a Paper)

I am trying to reproduce numerically the results found in this paper: https://ieeexplore.ieee.org/document/1707778 You don't necessarily need to read it. Basically I boils down to solving a two ...
2
votes
2answers
90 views

How to avoid problems with the large imaginary part of LegendreQ?

I am trying to evaluate sums involving LegendreQ[n,x], the n-th order Legendre function of the second kind $Q_n(x)$, at large $x>1$. However, the problem is that ...
2
votes
1answer
57 views

Numerical solution of a system of two exponential equations

I need to solve this two equations for x and y: ...
2
votes
1answer
110 views

How to get Mathematica to Return an Actual Numerical Result For Probability? [closed]

This is a painfully basic question. It's probably been answered before (or might be in one of the documentation packages), but I've been looking for some time and can't find it! (Though it could very ...
2
votes
2answers
680 views

Center column heading in TableForm

I have a TableForm as follows: ...
2
votes
1answer
66 views

What Heads do not have the attribute NumericFunction, but still give True in NumericQ?

The following expressions give True in the NumericQ test: ...
2
votes
2answers
265 views

How to make a single-variable out of a NDSolve solution?

So I've got this line that contains the solution of a partial, non-extraordinary differential equation (because Mathematica doesn't handle extraordinary partial differential equations): ...