New answers tagged

1

You can hard code the curvature and apply it to your image2 and plot it. Then the inflection points are where the curve intersects the horizontal axis. Use the code below after your code. I find that there are two inflection points. curvature[x_] := D[#, {x, 2}]/Sqrt[1 + D[#, x]^2]^(3/2) &; k[x_] = curvature[x][image2] Plot[k[x], {x, 20, 60}]


4

Let's rename things slightly to make it more consistent g = Fit[newdata, {1, x, x^2, x^3, x^4}, x]; To find inflection points, you can just put (blue) points where the second derivative is zero. Plot[g, {x, 20, 60}, Epilog -> {Red, PointSize[0.02], Point[newdata], Blue, Point[{x, g} /. Solve[D[g, {x, 2}] == 0]]}, PlotRange -> {{-5, 70}, {-5, ...


2

Another form I have found useful is: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] Then one can make derivative functions that can be treated as normal function via dfdx[x_, y_] := Evaluate[D[f[x, y], {x, 1}]] dfdy[x_, y_] := Evaluate[D[f[x, y], {y, 1}]] and the second derivatives d2fdx[x_, y_] := Evaluate[...


2

Using an example from the documentation of ListInterpolation: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] dfdx[u_, v_] := D[f[x, y], x] /. {x -> u, y -> v} dfdy[u_, v_] := D[f[x, y], y] /. {x -> u, y -> v} Manipulate[ Show[{Plot3D[f[x, y], {x, 0, 1}, {y, 0, 2}], Graphics3D[{Red, PointSize[0.03]...


1

Please make your question clear. But I think you're simply using f'[x,y] and hope that you can get a result? Try the following code: f = ListInterpolation[ Table[Sin[x y], {x, 0, 1, .25}, {y, 0, 2, .25}], {{0, 1}, {0, 2}}] D[f[x, y], x] Plot3D[Evaluate@D[f[x, y], x], {x, 0, 1}, {y, 0, 2}] for higher order: D[f[x,y],{x,2}] Will this code help? ...


1

There's not enough information in the question, but this approach fits one interpretation of the description of the situation. One can do the integral in the original NDSolve calls that generated rad and mm. (This may be what J.M. was suggesting in a comment. Or he may have meant executing a separate NDSolve call. I would recommend the approach given ...


2

The problem with your second code block is that r[[1]], r[[2]] etc. are not the first, second etc. components of the vector field as you would expect. If you input numerical values for x, y, z in intfpressure, e.g. intfpressure[0,0,0], then r is just a list of three numbers, so differentiating the elements of this list with respect to either of the ...


1

This works for me: Clear[intfcurl]; intfcurl[x_?NumericQ, y_?NumericQ, z_?NumericQ] := With[{q = intfd[x, y, z]}, {q[[2, 3]] - q[[3, 2]], q[[3, 1]] - q[[1, 3]], q[[1, 2]] - q[[2, 1]]}] VectorPlot3D[intf[x, y, z] intfcurl[x, y, z], {x, -3, 3}, {y, -3, 3}, {z, 0, 1}] (But it helps not to have testdata based on a function with zero curl!)


1

You can generate data with proper replacement and use ListVectorPlot3D. vector = Table[intf[x, y, z] /. {x_, y_, z_} :> {x, 5 y, z}, {x, -3, 3}, {y, -3, 3}, {z, 0, 1}]; ListVectorPlot3D[vector] Or to do it in your way intf1[x_, y_, z_] := Module[{q = intf[x, y, z]}, {q[[1]], 5 q[[2]], q[[3]]}] VectorPlot3D[intf1[x, y, z], {x, -3, 3}...


2

Import takes all sheets, which nests the data. First@ takes the first sheet formatting the data you need for the subsequent expressions. test = First@Import["Velocidade Angular.xls"]; time = test[[All, 1]]; x = test[[All, 2]]; f = Interpolation[Transpose[{time, x}], InterpolationOrder -> 3]; Show[ ListPlot[test[[All, 1 ;; 2]], PlotStyle -> Red], ...


1

Fit your data to a CDF using NonlinearModelFit data = {{406.833, 0.05}, {423.458, 0.1}, {436.375, 0.15}, {448.042, 0.2}, {459.583, 0.25}, {467.75, 0.3}, {479.083, 0.35}, {489.917, 0.4}, {500.875, 0.45}, {508.542, 0.5}, {521.792, 0.55}, {536.75, 0.6}, {547.458, 0.65}, {560.667, 0.7}, {584.208, 0.75}, {598.583, 0.8}, {632.875, 0.85}, {672....


3

A couple of points: You have some duplicate coordinates in your data, these need to be removed before you can interpolate A couple of the points in your list are outside the range you've specified. Therefore you need to extrapolate, not interpolate, and the results at these points can't be trusted. data0 = DeleteDuplicatesBy[data0, #[[;; 2]] &]; ...


3

This is not a full answer, but it seems to me that you may have a use for code that allows you to group the points by the orbit they belong to, as Jason also mentioned. It seems to me that, with this in hand, the problem may be reduced to the one @JasonB solved in your previous question. Here's a start in that direction: paths = FindClusters[data0, 15, ...


3

You can make an interpolating function for both px and py from the data you have: data = Import["Downloads/lyap_4d.dat", "Table"]; d00 = data[[All, {1, 2}]]; pyfunc = Interpolation[{{#1, #2}, #4} & @@@ data, InterpolationOrder -> 1]; pxfunc = Interpolation[{{#1, #2}, #3} & @@@ data, InterpolationOrder -> 1]; That answers the question ...


0

Here is some code that does what I think you are trying to do. It is best to avoid C as a variable name because it has predefined behaviour A = {{1, 2}, {2, 5}, {3, 8}, {5, 16}} B = {{1, 3}, {3, 4}, {4, 2}, {5, 0}} Af = Interpolation[A] Bf = Interpolation[B] c[x_] := Af[x] + x Bf[x] Plot[c[x], {x, 1, 5}]


2

Here is a function for multiplying InterpolatingFunctions generated from a single NDSolve (so that the coordinate grids are the same, as well as one-dimensional). This yields a single InterpolatingFunction that interpolates the product. It carries over derivative information, too. (I've done this before on the site, I think.) Anyway, Integrate on an ...


3

You have many superfluous sets of {} that generate unexpected output in your code. In particular, the Interpolation functions generated by NDSolve were not returning a scalar value, but instead a unidimensional vector, i.e. a list containing a single value instead. That was probably an unintended consequence of the extra sets of braces in the definitions of ...


3

Clear["Global`*"] yy = 10^-4; rr = 0.999; xx = 10^-15; zz = 10^-4; mm = 10^-4; yy + rr + xx^2 + zz - mm^2 - zz^2/24 ic = -17.5 s = NDSolve[{D[y[t], t] == (3 y[t])/5 - (12 m[t]^2 y[t])/5 + (2 r[t] y[t])/ 5 - (6 x[t]^2 y[t])/5 + (3 y[t]^2)/5 + (7 y[t] z[t])/ 5 - (y[t] z[t]^2)/10, D[r[t], t] == -((2 r[t])/5) - (12 m[t]^2 r[t])/5 + (2 r[...


0

I have found yet another way to solve this. Based on J.M.'s answer and another post on defining the derivative of Abs for Real valued functions (will look it up later to add here). The following code works: Derivative[1][Abs][x_] := Re[ Conjugate[x] D[x, s] ]/Abs[x]/D[x, s]; Plot[D[Abs[k[s]], s] /. k -> kf /. s -> ss, {ss, 0, 1}] It is worth ...


2

Alternatively, you could do a little complex number algebra for the purpose: kf = NDSolveValue[{I k'[s] == 20 (s k[s] - (1 - s) (1 - k[s]) (1 + k[s])), k[0] == 1/2}, k, {s, 0, 1}]; Plot[{10 Abs[kf[t]], Re[kf[t] Conjugate[kf'[t]]]/Abs[kf[t]]}, {t, 0, 1}, PlotLegends -> {"scaled function", "numerical derivative"}]


3

You could try using numerical differentiation from the Numerical Calculus package: Clear[r, fun] Needs["NumericalCalculus`"] r = NDSolve[ {I k'[s] == 20 (s k[s] - (1 - s) (1 - k[s]) (1 + k[s])), k[0] == 1/2}, k, {s, 0, 1} ]; fun[s_] := Abs[(k /. r[[1]])[s]]; Plot[ {10 fun[t], ND[fun[s], s, t, Terms -> 20]}, {t, 0, 1}, PlotLegends -&...


4

I'll just treat the simplest case of interpolating across four noncoplanar points. The extension to general grids is straightforward (one just joins multiple pieces appropriately). Consider the following bivariate interpolating polynomial: ip[x_, y_] = InterpolatingPolynomial[{{{0, 0}, 1}, {{0, 1}, -1/2}, {{2, 0}, 1/2},...


4

ListDensityPlot interpolated by constructing a Delaunay triangulation of the data points and interpolating linearly on each triangle. For a perfectly rectangular point grid, there are two ways to break each rectangle into triangles. If we distort the grid slightly and make each rectangle a parallelogram, then there will only be one way to construct the ...


3

If the function's derivative is easy to obtain, then the default piecewise interpolation works fairly well when the derivative values are specified. One can also use FunctionInterpolation. With FunctionInterpolation you can adjust the options to achieve a desired accuracy. f = x^-5; df = D[f, x]; data = Table[{{x}, f, df}, {x, 1., 100.}]; ifn1 = ...


1

You can just sample your function on a finer grid. Using grid spacing of 1, like you are, leads to horrible interpolation, whereas a grid spacing of 0.1 works out perfectly. (data = Table[{x, x^-5}, {x, 1, 100, #}]; Show[ Plot[Interpolation[data, InterpolationOrder -> 3][x], {x, 1, 10}, PlotRange -> All, ImageSize -> 400], ListPlot[...


9

In this case, the data are very unlike a polynomial, thus ill-suited for polynomial interpolation. On the other hand, the inverse data represent a polynomial, so interpolate them: invdata = Transpose@{points, 1/hyper}; invinterp = Interpolation[invdata] Plot[1/invinterp[x], {x, 1, 10}] In general, the art of polynomial approximation and interpolation ...


6

This is due to the interpolation. If you turn off the interpolation by InterpolationOrder -> 0 you will see symmetric plot. data = Flatten[Table[{x, y, If[x == y, 1, 0]}, {x, 0, 1, 1/10}, {y, 0, 1, 1/10}], 1]; dataR = data; dataL = data /. {x_, y_, z_} :> {-x, y, z}; data0 = Join[dataL,dataR] ListDensityPlot[data0, ...


6

I think your best bet is to generate a triangualted polygon surface. Here is an initial stab at it: p2d = b[[All, 1 ;; 2]]; tri1[i_, j_] := If[EvenQ[j], {{i, j}, {i + 1, j}, {i + 1/2, j + 1}} .05, {{i + 1/2, j}, {i + 1 + 1/2, j}, {i + 1, j + 1}} .05] tri2[i_, j_] := If[EvenQ[j], {{i, j}, {i + 1, j}, {i + 1/2, j - 1}} .05, {{i + 1/2, j}, {i + ...


8

Not sure how useful will this be. Usually Standardize-d data is giving better results. We can also cut off parts of the surface which are distant from our data. rf = Nearest[Standardize@data] sr = ListSurfacePlot3D[Standardize @ data, BoxRatios -> 1, MaxPlotPoints -> 100, RegionFunction -> Function[{x, y, z}, Norm[{x, y, z} - rf[{x, ...


2

In such situations some sort of preprocessing of the data might be very useful: Clear[int, x] int[x_] = With[{data = {#1, Log@#2} & @@@ dat}, Exp[Interpolation[data, InterpolationOrder -> #, Method -> "Spline"][x]]] & /@ Range[2, 7]; Show[Plot[Evaluate@int[x], {x, 0, 10}, PlotRange -> All], ListPlot[dat], PlotRange ->...


3

As I mentioned in a comment this blog post, "Find Fit for Non-linear data", discusses a similar problem. Quantile Regression (QR) can produce a good enough interpolation of order two: Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/QuantileRegression.m"] qfunc = First@ QuantileRegression[dat, dat[[All, 1]], {0.5}, ...


3

One could try to find a solution with FindFormula. dat = {#, Exp[-#]} & /@ Append[Range[0, 3, .5], 10]; Plot[Evaluate@FindFormula[dat, x], {x, 0, 10}, PlotRange -> All, Epilog -> {Red, PointSize@Medium, Point@dat}] Addendum For the 2nd try to solve the problem I use BSplines. I insert a point until the curve is smooth. We don't know the ...


5

Interpolation sometimes does not handle endpoints well, and this appears to be exacerbated in the present case, because the upper endpoint is far removed from the rest of the points. One workaround is to provide more, but very closely spaced, points of identical value (so that there is no need to know the form of the original function there) near the upper ...



Top 50 recent answers are included