Questions tagged [numerical-value]

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

Numerical Calculations

Exact symbolic results are usually very desirable when they can be found. In many calculations, however, it is not possible to get symbolic results. In such cases, you must resort to numerical methods.

N NIntegrate NSum FindRoot NSolve FindMinimum NMinimize

370 questions
10
votes
2 answers

Could I define 0^0 to be 1?

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 there a way to define this 0^0=1? What are the…
Chen Stats Yu
  • 4,986
  • 2
  • 24
  • 50
4
votes
3 answers

A generic way to deal with intermittent non-numerical values in arrays

Sometimes when dealing with arrays with intermittent non-numerical values (e.g., NaNs imported from external sources), the common arithmetic functions (e.g., Median) may break annoyingly. Although it's possible to replace those NaNs with…
sunt05
  • 4,367
  • 23
  • 34
3
votes
1 answer

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 trainset = {{1,2}, {2,4}, {3,6}} fn = Predict[trainset] Now I want to solve for m Solve[fn[m] == 5,…
Anjan Kumar
  • 4,979
  • 1
  • 15
  • 28
3
votes
1 answer

Dealing with square roots

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: f[x_] := Sqrt[ -(2 Sqrt[x^(-8/3) - x^(-4/3) + 1] x^(4/3) + 5) x^(4/3) + 4…
stinglikeabeer
  • 363
  • 1
  • 8
3
votes
0 answers

Avoiding underflow with equations of the form $\binom{n}{x} p^a (1-p)^b$

I have the need to evaluate equations of the form $$\binom{n}{x} p^a (1-p)^b$$ where the values of $p$ are between 0 and 1 and $n$, $x$, $a$, and $b$ can be very large numbers. I attempt to use parms = {n -> 200, x -> 103, a -> 105, b -> 98}; e =…
JimB
  • 41,653
  • 3
  • 48
  • 106
3
votes
2 answers

Mathematica will not solve this numerical equation

I have the following equation: eq = 0.003101895368576676` f - 500000/(1057 f \[Pi]) - (0.43169299511061626` Cos[0.019329990640367303` f] Sin[0.019329990640367303` f])/(1.0609` (1.37`*^-11 + 0.222185005727138`*^-7 Sqrt[f])^2 Cos[0.019329990640367303`…
3
votes
1 answer

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 {{-(1/2), Sqrt[3]/2}, {-(1/2), -(Sqrt[3]/2)}, {1, 0}, ...}) and I need to compare…
Sumit
  • 15,912
  • 2
  • 31
  • 73
3
votes
0 answers

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

Is there a function that returns me the largest common divisor? I tried this: Intersection[Divisors[200], Divisors[280]] // Last
LCarvalho
  • 9,233
  • 4
  • 40
  • 96
2
votes
0 answers

How to convert a dollar fraction into a normal dollar amount

I'm trying to use Mathematica to compute compounded interest. I used Wolfram Alpha, and it gave me the code FormulaData[{"PresentValueFutureValue", "Standard"}, {"PV" -> Quantity[100000, "USDollars"], "i" -> Quantity[7, "Percent"], "n" ->…
Pro Q
  • 231
  • 1
  • 3
1
vote
1 answer

Numeric values from transform

How would I create a table of values from a transformation? eg: r1 = 1; r2 = 1000; primorial[n_] := Times @@ Prime[Range[n]]; plot = ListLinePlot[Table[N[Log[primorial[n]]], {n, r1, r2}]]; plot /. L_Line :> {GeometricTransformation[L,…
martin
  • 8,678
  • 4
  • 23
  • 70
1
vote
1 answer

Why is Mathematica not able to calculate more digits

When I want a numerical value with a precision of 50 digits... N[1.15/(1 - E^-0.2)^2, 50] Why is Mathematica not able to provide the desired solution? And I know that this is irrational and the given solution is not precise and besides Mathematica…
Gab
  • 433
  • 3
  • 10
1
vote
2 answers

Numerically evaluating giant fractions

I would like to know the numerical value of a giant fraction, which I got from doing some combinatoric calculation (n choose k gets huge). For example, say I have Sum[Binomial[2048, k] (1/5)^k (4/5)^(2048 - k), {k, 9728/25, 10752/ 25}] This code…
Rotartsi
  • 113
  • 4
1
vote
1 answer

How do I restrict this to 3 decimal places?

I use the following code to calculate the force of wind-pressure on a kite - it's simplistic, but gives me what I need. The problem I have is that I can't produce the result to 3 decimal places: N[(1/2)*\[Rho]*v^2*a, 3]] doesn't work. How do I fix…
Richard Burke-Ward
  • 2,231
  • 6
  • 12
1
vote
1 answer

Finding the value which gives a list total of zero

Is there a way to check if x will converge for Total[g] approaching zero in this code example? For n=15000000, 1.87 < x < 1.88, but takes awhile to run. Thanks. cheers, Jamie n = 500000; a = Select[Range[n], FactorInteger[#][[1, 1]] >= 5 && !…
Jamie M
  • 503
  • 2
  • 7
1
vote
1 answer

How do I to remove a factor of 1

I evaluated Subscript[ε, 1, 2] = 0.5 Subscript[γ, 1, 2] 2 μ Subscript[ε, 1, 2] 1. μ Subscript[γ, 1, 2] How do I to remove the factor 1.?
ABCDEMMM
  • 1,816
  • 1
  • 9
  • 17
1
2