Tag Info

New answers tagged

0

Some points: You are integrating a function of InterpolatingFunction. See this thread for guidance how to achieve maximum precision in this situation using NIntegrate. You are using Sum for summing up imprecise numbers which is the worst way to do this as demonstrated here. Use Total with option "CompensatedSummation" -> True instead. Avoid using ...


2

This will do it: InterpolatingPolynomial[{{r1, y1, yp1, ypp1}, {r2, y2, yp2, ypp2}}, r] InterpolatingPolynomial returns the polynomial of minimum degree that satisfies the given conditions. Since you have six conditions, you will automatically get a fifth-order polynomial.


2

The default method is Hermite: data = {{-2, 0}, {-1, -1}, {1, 1}, {2, 0}}; Interpolation[data]["InterpolationMethod"]; (* "Hermite" *) With spline interpolation the second derivative is piecewise linear, and is not necessarily zero at the endpoints: Plot[Interpolation[data, Method -> "Spline"]''[x], {x, -3, 3}]


1

Setup: data = {{10.24, 10.15, 10.01, 9.81, 9.39, 8.8, 8.57, 7.89, 7.23}, {21.50, 21.52, 21.25, 20.88, 20.79, 20.66, 20.37, 19.98, 19.50}, {31.92, 32.09, 31.87, 31.58, 31.31, 30.99, 30.86, 30.87, 30.41}, {43.56, 43.88, 43.63, 43.29, 43.02, 42.57, 42.16, 42.52, 42.25}, {54.85, 55.28, 54.98, 54.57, 54.36, 54.07, 53.78, 54.03, 54.12}, ...


0

Update, as per new requests: Importing from xls files: s = Part[Import["~/Downloads/s.xlsx"], 1, 1] t = Part[Import["~/Downloads/t.xlsx"], 1, 1] data = Part[Import["~/Downloads/data.xlsx"], 1] (* Using @ubpdqn much nicer data massaging *) table = Join @@ MapThread[Join[{#1}, {#2}] &, {Outer[List, s, t], data}, 2]; For the part 1) of your request: ...


4

Using Mathematica version 10 new Predict Function t = {200, 182, 164, 146, 128, 110, 101, 92, 83}; s = {10, 20, 30, 40, 50, 60}; data = {{10.24, 10.15, 10.01, 9.81, 9.39, 8.8, 8.57, 7.89, 7.23}, {21.50, 21.52, 21.25, 20.88, 20.79, 20.66, 20.37, 19.98, 19.50}, {31.92, 32.09, 31.87, 31.58, 31.31, 30.99, 30.86, 30.87, 30.41}, {43.56, 43.88, 43.63, 43.29, ...


2

The data is nearly colinear, so much so that it appears to be colinear to the mesh generator. Rescale the data so that it appear to occupy a region. Let data be the argument to Interpolation in the OP's question. The values of x are too close, and some experimentation shows that scaling by 100 produces a result: ifn[x_?NumericQ, y_?NumericQ] = ...


6

If you set the contents of your interpolation function to be the variable data={{..,..},..} (such that Interpolation[data] gives the message), you can look at the mesh generated with: Needs["NDSolve`FEM`"] mesh = ToElementMesh[data[[All, 1]]] That also gives the message. Looking at mesh["Wireframe"] gives you an idea what is going on. You can then use ...


5

The error I get is that the integrals do not converge. I expect that this is because the empirical PDFs are zero far from the data, and Mathematica does not automatically take $0\log 0$ to be $0$. You can do it explicitly as follows: NIntegrate[With[{f = PDF[smoothDistribution1D, x]}, If[f > 0, f Log[f], 0]], {x, -∞, ∞}] (* -1.4238 *) Compared to the ...


3

You may do it with Interpolation[] by expanding the list with a parameter value: l = {{0, 0}, {1, 0}, {.5, 1}, {-1, -2}, {1, 3}}; f = Interpolation[Table[{i, l[[i]]}, {i, Length@l}], InterpolationOrder -> #] & /@ {3, 4}; Row[ParametricPlot[f[[#]][t], {t, 1, Length@l}, Epilog -> {Red, PointSize[Medium], Point@l}, AspectRatio ...


2

Using Method->"ExplicitRungeKutta" with a larger value of the option "DifferenceOrder" allows recovering more terms of the series expansion.


1

As b.gatessucks suggested you can use ParametricNDSolve, here is my attempt: sol = ParametricNDSolve[{y'[x] == A* y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}, {A}] Integrate[Evaluate[Table[y[x][A] /. sol, {x, 0, 30, 1}]], {A, 1, 10}] I obtained: {9., 2.45807, 1.26895, 0.899877, 0.722946, 0.61851, 0.549178,0.504711, 0.473531, 0.454667, 0.335436, ...



Top 50 recent answers are included