30 votes
Accepted

Is Internal`StringToDouble broken in 12.3?

StringToDouble was renamed StringToMReal as part of code cleanup and the addition of several friends: ...
  • 13.7k
21 votes

GroupBy twice gives different results

Quit the kernel before each test. This is on MMA 10.3 on Mac OS X. Simplify the problem We can simplify so that tmp is much much smaller and easier to analyse: <...
19 votes

GroupBy twice gives different results

It looks like a problem of numeric cache: ...
  • 43.1k
17 votes

Numerical voodoo in mathematica?

To get exact output, use exact input (and please input your question using plain text Mathematica code that one can easily copy). ...
  • 116k
16 votes

Solve Laplace equation in Cylindrical - Polar Coordinates

Here is a analysis of all the problems related to Mathematica in your question. Briefly summarized, These are 3 problems : the lack of build-in tools to visualize the potential and vector field in ...
  • 17.1k
15 votes
Accepted

Solve Laplace equation in Cylindrical - Polar Coordinates

I think it is better to use Cartesian coordinates because one does not have to deal with the periodicity in p. To have control on the meshing of the the region, we tell Mathematica explicitly to ...
15 votes
Accepted

Why does Abs return negative values?

It is a bug that will be fixed in the nearest release of Mathematica. It affects Abs/Sign of positive Root objects with third argument 1, for which the real root isolation algorithm produces an ...
14 votes
Accepted

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

lst = {{2, -2}, {1, 5}, {1, -3}, {-3, 3}}; Pick[lst, Total[lst, {2}], 0] {{2,-2}, {-3,3}} ...
  • 351k
14 votes

Could I define 0^0 to be 1?

Yes, by doing this (similar to this): Unprotect[Power]; Power[0|0., 0|0.] = 1; Protect[Power]; If you want to revert to normal: ...
  • 31.2k
14 votes
Accepted

How to obtain numerical solutions of a two-variable equation?

There are infinitely many (continuum) solutions and basically one cannot list them all e.g. because of the Cantor theorem. This is the reason why numerical approach is unsatisfactory. However we can ...
  • 54.6k
13 votes

Numerical voodoo in mathematica?

The problems at hand comes from using inadequate numerical approximation. The equation behind is quite simple and it can be solved exactly, we put 10/3 instead of <...
  • 54.6k
11 votes
Accepted

How to find and express all polynomial roots with greatest precision?

Your numericRoots are OK. The core of your problem is that you use Expand to put your polynomial into power series form. High order power series are numerically unstable. The form your z function ...
  • 13.6k
11 votes

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

direct implementation of Chudnovsky formula for reference: ...
  • 38.5k
10 votes
Accepted

Is it possible to ask Mathematica to give the maximum value of a function over a specific domain?

NMaximize[{f[n], 1 <= n <= 10^6, n ∈ Integers}, n] (* Out: {63.041, {n -> 2}} *) You can then get the corresponding symbolic function value using your ...
  • 63.1k
10 votes
Accepted

Problem with NDSolveValue

I will present an anisotropic meshing solution that will allow you to resolve a sharp normalized peak at the center of your cube. Many links applying this technique are in my answer to the question ...
  • 16k
9 votes
Accepted

Mathematica will not solve this numerical equation

...
  • 116k
9 votes
Accepted

Some Strange results from MMA and Matlab

The line Table[N[PHI30EQ[u], 30], {u, 0, 0.1, 0.001}] doesn't do what you think it does. You're asking for 30 digits of precision, but you supply ...
  • 19.2k
9 votes

NDSolve giving a wrong solution

The general problem In using NDSolve to solve first-order IVPs, there are basically two ways to set up the ODE: ...
  • 222k
8 votes

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

I think your problems are made by order of appling Re and N. Re@Bloch is not yet a state ...
  • 5,115
8 votes
Accepted

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

Here is an adaptation of MATLAB code from Trefethen, Ten Digit Algorithms (2005), based on Borwein & Borwein, The Arithmetic-Geometric Mean and Fast Computation of Elementary Functions (1984) that ...
  • 222k
8 votes
Accepted

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

Your problem is similar to a wave spectra problem and a regression problem, and I have both types of problems going on at work right now which is why I've thought about your problem a bit. Here is an ...
8 votes

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

The documentation for N says that N[expr, n] attempts to give a result with n-digit precision. In the Wolfram Language, or any ...
  • 9,971
7 votes
Accepted

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

Update: I think this is a numeric precision problem rather than a matter of the behavior of Re. I don't know if I should leave my original answer below for ...
  • 265k
7 votes
Accepted

How to make an Histogram where the data are strings?

BarChart[Counts[{"a", "a", "b", "c"}], ChartLabels -> Automatic] By using Counts instead of ...
7 votes
Accepted

How to plot output data of Do-command?

This is a good candidate for NestList ...
  • 34.6k
7 votes
Accepted

Comparing exact expressions vs real numbers

PossibleZeroQ is rather fast and does precisely what you're looking for: RepeatedTiming[PossibleZeroQ[a - b]] {3.2*10^-6, ...
  • 38.1k
7 votes

1-D PDE with nonlinear ODE as boundary condition

NDSolve currently can't handle coupled PDE and ODE, so let's discretize the system all by ourselves, but before that, I'd like to point out the system actually has ...
  • 55.3k
7 votes
Accepted

Why mathematica does not solve the equation $x\left \lfloor x \right \rfloor=10$ for $x$?

You can specify you want real solutions Solve[x*Floor[x] == 10, x, Reals]
  • 356
7 votes
Accepted

Root finding: Is there no bisection method root finder?

There's a bisection method right here. Use bisect = ResourceFunction["BisectionMethodFindRoot"] ...
  • 20.6k

Only top scored, non community-wiki answers of a minimum length are eligible