Tag Info

New answers tagged

2

Ok, here is my stab at understanding the issue. To begin, this is how I am interpreting the integral (it is always a good idea to clearly mark the dependence of your symbols): $$\frac{\int_0^{\infty } i(q)\,q^2 \cos (q\,x) \, dq}{\int_0^{\infty } i(q) \, q^2 \, dq}$$ where $i(q)$ is the intensity as a function of $q$. So, lets interpolate over the data ...


0

Well, a good question. One way is to use interpolation. I will take a part of your data just for the sake of example: data = {{0.06781, 8484.9}, {0.07145, 8104.34}, {0.07508, 7511.06}, {0.07872, 6941.88}, {0.08236, 6731.36}, {0.08599, 5949.97}, {0.08963, 5077.74}, {0.09327, 4354.2}, {0.0969, 3756.52}, {0.10054, 3259.68}, {0.10418, 2853.38}, {0.10781, ...


3

Clear[f, g, gg] g = FunctionInterpolation[-(x - a)^2, {x, 0, 2}, {a, 0, 2}]; gg[a_?NumericQ, b_?NumericQ] := g[a, b]; f = FunctionInterpolation[ArgMax[{gg[x, a], 0 <= x <= 2}, x], {a, 0, 2}] f'[1] (* InterpolatingFunction[{{0.,2.}},<>] 1. *)


2

I can't think of a way to do this without indexing the data. If that's not a problem, the following will do: With[{ indexed = MapIndexed[ {Sequence @@ #2, #1} &, Sin[0.5 Range@100] /. {a_?Negative -> Missing[]} ] }, ListPlot[ SplitBy[ indexed, NumericQ@Last@# & ], Joined -> True, InterpolationOrder -> 2 ...


1

You could just do without Missing: ListPlot[Cases[{#, Sin[0.5 #]} & /@ Range[100], {_, _?NonNegative}], Joined -> True]


0

I think this is an issue of the interpolation order being too high and the resulting function not being 1 - 1. A way is to set the InterpolationOrder to 1 or (safer) to create the inverse function by inverting the data and then interpolating: inv2 = Interpolation[Reverse /@ Range[Length@Array2]~Riffle~Array2~Partition~2]; so that inv2[int2[5.]] 5.


1

First method includes all the boundaries. In effect it is an estimate of the integral over $225<x<255, 305<y<455$. Omit the lower edges and the two calculations agree. Total[Select[Data, 230 < #[[1, 1]] <= 250 && 310 < #[[1, 2]] <= 450 &][[All, 2]]*100] Integrate[ Interpolation[Data, InterpolationOrder -> ...



Top 50 recent answers are included