# Tag Info

0

One way to address the example is to provide input of the same or higher (arbitrary) precision, sofindmassz[0, 0.1492171462000523615, 0.0745539351300329615, 1.01652285360692215, workprec -> 15] (* 0.643229985259241 *) One can get overflow, probably from f1d[h_] := -Exp[ξ[h]/T]/(T (Exp[ξ[h]/T] + 1)^2) because the size of ξ[h] can be quite ...

2

lets make a fair fortran test... raise a complex typed number 1 to the power: write(*,*)(-1.d0,0.d0)**2.,(-1.d0,0.d0)**2 (1.00000000000,-2.449212707...E-16 ) , ( 1.0000000000,0.000000000 ) also note in fortran the real power can not yield a complex result, that is -1.**.5 throws an error or yields NaN depending on the compiler so you see -1.**2. ...

1

Here is the "code" of your question with unspecified blanks filled in and errors fixed: F[u_] := Log[u] - Cos[u^2] Exp[-u]; Umax[x_, y_] := x + y; W[x_?NumericQ, y_?NumericQ] := NIntegrate[F[u], {u, 0, Umax[x, y]}]; g[x_?NumericQ, y_?NumericQ] := x^2/y^2; Alpha[x_?NumericQ] := Tanh[x]; myFunction[x_?NumericQ] := NIntegrate[g[x, y]*W[x, y], {y, ...

1

ListPointPlot3D[data, PlotStyle -> Directive[PointSize[0.02], Thickness[0.01]]] /. Point[x_] -> Through[{Point, Line}[x]]

1

d = data /. {x_Real, y_Real, z_Real} -> {{x, y}, z}; dat = Flatten[d, 1]; int = Interpolation[dat]; Plot3D[int[x, y], {x, 0, 1.6}, {y, 0.1, 10}, Mesh -> {data[[All, 1]][[All, 1]], data[[1, All]][[All, 2]]}, PlotStyle -> Opacity[0.5], MeshStyle -> {Red, Blue}] The idea is to use Mesh option for drowing lines on surface obtained from ...

4

My guess is that when you write 1. and 2. as opposed to 1 and 2 you are telling Mathematica that the numbers you are using are not integers but that they are rather real numbers whose best decimal representation is, as far as you know or within your accuracy criteria, 1.0 and 2.0. Thus, numerical methods are legitimate and you can expect numerical errors. ...

8

My original answer (below) is wrong. Arbitrary precision does not fix this problem, I only fooled myself (and others) into thinking that it does. Now please consider: Power[-15, 25] 1.0000 + 0.*10^-5 I This agrees with the output of the effective computation that Daniel described in a comment: power[base_, pow_] := Exp[pow*Log[base]] power[-15, ...

1

I propose a silly workaround, instead of a workable explanation: Get["tb.dat"]; xls = Range[-500, 500, 1000/(1000 - 1)] // N; test[tb_] := (Re[Conjugate[#].(xls*#)] & /@ tb;) // AbsoluteTiming; test[RandomComplex[{0., 1. + I}, Dimensions[tb]]] (* {0.002002, Null} *) test[tb] (* {0.040038, Null} *) test[tb + ConstantArray[0. + 0. I, Dimensions@tb]] (* ...

3

Couple of additional or summary points. This is a great question for the 21st century. Since the question regards mathematical definitions, "domain" isn't defined (at least by itself, unlike say "integral domain"). Instead should refer to specific categories like Set. Be especially careful with fields, eg non-Archimedean ones. IEEE 754 floating point was ...

2

This is a typical Finite Difference Method. x = dat[[;; , 1]]; y={#}~Join~(# + Accumulate[Differences[x] dat[[2 ;;, 2]]]) &@dat[[1, 2]]; Now f = Interpolation[Transpose[{x, y}], InterpolationOrder -> 1]; Plot[f[x], {x, 0, 110}, AspectRatio -> Automatic,GridLines -> {x, None}]

3

Although I like DumpsterDoofus's answer a lot more, now that I am properly awake I realize this works: dat = {{0, 0}, {18, 1}, {70, 1/4}, {90, -1}, {110, 2}}; g[{x_, y_}, {X_, Y_}] := {X, y + (X - x) Y} f2 = Interpolation[FoldList[g, dat], InterpolationOrder -> 1]; Plot[f2[x], {x, 0, 110}, AspectRatio -> Automatic, GridLines -> {{18, 70, 90}, ...

3

funny I just worked this up for this answer here : http://mathematica.stackexchange.com/a/71427/2079 dat = {{0, 0}, {18, 1}, {70, 1/4}, {90, -1}, {110, 2}}; xmap[x_] = Piecewise[ Fold[Append[#, {(#[[-1, 1]] /. x -> (Last@Last@Last@#)) + #2[[2]] (x - (Last@Last@Last@#)), x < #2[[1]]}] &, {{x dat[[2, 2]], x < ...

15

Integrate the zero-order interpolation of the data: f[x_] = Integrate[Interpolation[dat, InterpolationOrder -> 0][x], x]; Plot[f[x], {x, 0, 110}, AspectRatio -> Automatic, GridLines -> {{18, 70, 90}, None}] It can efficiently plot piecewise functions with thousands of transition points in milliseconds: dat = {Accumulate@RandomReal[{0, 1}, ...

12

For readers who didn't read all the comments, the slowdown is due to a lack of packing of tb, whereas RandomReal returns packed arrays when more than 250 elements are generated. The reason why packing tb fails is because some elements have different precision than others, and (I think?) ToPackedArray requires arrays to be of homogeneous type. To fix this, ...

2

It seems to be a performance problem (bug?) in version 9.0.1. Version 7.0.1 is also slow, but perhaps is not capable of this calculation. However, version 8.0.4 can produce the correct result quickly, so there seems to be no good reason why 9.0.1 should take so long. I didn't try 9.0.0. The interesting thing, is that 9.0.1 has no problem with the purely ...

10

As noted in post, responses and comments, Real is a Mathematica head and, as such, is distinct from Integer and Rational and Complex. All of these are regarded as "atomic" (notwitstanding that Rational has two Integer "parts", and Complex is comprised of any mix of the other three types). These atomic types are in a sense distinct from the domains one ...

13

In some settings the integers, fractions, rational numbers, reals, and complexes are five distinct systems. Further, for reals and complexes, there are the standard reals and complexes as well as nonstandard systems. There are mappings from some to others, so that a subset of the reals in an isomorphic image of the integers (as rings), and so on for ${\bf ... 3 The given integral can be integrated exactly and quickly. Integrate[fermitotal[beta, k, mu, delta] k^2, {k, 0, 20}] // AbsoluteTiming N@Last[%] (* {0.006876, 8000/3} 2666.67 *) But since, presumably, the OP's actual use-case is not, I'll comment on the set up and the relation of OP's choices to speed. Remarks on the OP's option settings Since it's a ... 1 I'm afraid that this is a bit puzzling indeed. If I use your example and run the NIntegrate without all the fancy options I get {0.006944, 2666.67}. So I assume it has something to do with your options. Leaving out the method, but leaving everything else in place, slows down things dramatically, but it is still doable: {0.561119, 2666.666666667}, ... 0 How about this: fermitotal[beta_?NumericQ, k_?NumericQ, mu_?NumericQ, delta_?NumericQ] := With[{ee = Eigenvalues[{{k^2 - mu, delta}, {delta, -k^2 + mu}}]}, 1/(1 + Exp[beta*ee[[1]]]) + 1/(1 + Exp[beta*ee[[2]]]) ]; nTotal[beta_?NumericQ, mu_?NumericQ, delta_?NumericQ] := NIntegrate[fermitotal[beta, k, mu, delta] *k^2, {k, 0, 20}] nTotal[50, 1, 1/10] // ... 1 Use the substitution rule as follows: myExpression /. Sqrt[x___] -> x^0.5 Example: myExpression = Cos[t] + Sin[y] + Sqrt[a y + Tanh[z] + u^3] Cos[t] + Sin[y] + (u^3 + a y + Tanh[z])^0.5 1 Using Picard iterations I get this series solution: First we convert it to standard form$x'=f(x(t),t)$and apply Picard: Problem: Solve$x^{\prime\prime}\left( t\right) +x\left( t\right) -10\left( 1-x\left( t\right) ^{2}\right) x^{\prime}\left( t\right) =0$with$x\left( 0\right) =2,x^{\prime}\left( 0\right) =0\$ Let ...

3

Although Implicit Euler is described in the documentation, it may not be an implemented Method. In fact, the Wolfram discussion of the Lotka–Volterra Equation actually defines Backward or Implicit Euler, suggesting that it is not an implemented Method: BackwardEuler = {"FixedStep", Method -> {"ImplicitRungeKutta", "Coefficients" -> ...

Top 50 recent answers are included