Tag Info

New answers tagged

2

The reasons for the change in the behavior of ParallelTable are subtle. The main source of the problem is that in funcB, the argument k_ is not protected with ?NumericQ like this: funcB[t_?NumericQ, k_?NumericQ] := (* a solution *) funcB[t, k] = Exp[NIntegrate[funcA[et, k], {et, tini, t}]] But more on that later. The problem does not appear in the ...


7

Following How to splice together several instances of InterpolatingFunction? which I updated earlier today, before seeing this question, there are several new Properties for InterpolatingFunction expressions in version 10: v7 = {"Coordinates", "DerivativeOrder", "Domain", "Evaluate", "Grid", "InterpolationOrder", "MethodInformation", "Methods", ...


1

Nothing much to add here...this is just a slight modification to István's answer where the call to Needs has been removed in favour of Mr. Wizard's undocumented trick. The calling syntax is slightly different, and I also call DeleteDuplitacesBy to avoid the Interpolation warning about multiple points at a single coordinate. ...


1

Two small changes make this work in a much nicer way: First, the use of NDSolveValue instead of NDSolve gets rid of this rule replacement monkey business. {tini, tfin} = {-Log[100], 0}; firstFuncK = NDSolveValue[{D[f[t, k], t] + f[t, k]^2 + (1 - t)*f[t, k] == 3/2*(1 + k^2), f[tini, k] == 1}, f, {t, tini, tfin}, {k, 0.001, 10}] (* ...


1

Yes! You have passed the same function f into a pure function so it is evaluated every time you calculate g. Specially you define f by = so Mathematica calculates it once and then re-use it in Do loop. For the sake of demonstration if I define f by :=: f1 := Interpolation[Table[{i, i^2}, {i, -5, 5}]]; f2 = Interpolation[Table[{i, i^2}, {i, -5, 5}]]; ...


9

Update The problem is subtler than my first analysis revealed. There is indeed a problem with the variable et in NIntegrate not being properly blocked. Part of the problem has to do with the extra braces in firstFuncK which has the form {{f -> InterpolatingFunction[<>]}} Somehow that leads to an evaluation of et in the integrand f[et, k] /. ...


1

x = y = RandomReal[1, 100]; p = Position[Differences@x, n_Real /; n > 0.1] + 1 // Flatten; Table[y[[n]] = (y[[n - 1]] + y[[n + 1]])/2, {n, {p}}]; ListLinePlot[{x, y}, ImageSize -> 600, PlotLegends -> {"original", "substituted"}]


0

Perhaps something along the following lines? data = {{27.342, -0.01}, {27.443, -0.03}, {27.546, -0.01}, {27.743, -0.01}, {27.945, -0.01}, {28.145, -0.03}, {28.246, -0.05}, {28.346, -0.06}, {28.547, -0.01}, {28.747, -0.01}, {29.149, -0.01}, {29.249, 0}, {29.45, -0.01}, {29.651, -0.05}, {29.852, -0.05}, {30.053, -0.01}, ...


0

For example, modifying data if first value is > -0.2 :- data = {{27.342, -0.01}, {27.443, -0.03}, {27.546, -0.01}, {27.743, -0.01}, {27.945, -0.01}, {28.145, -0.03}, {28.246, -0.05}, {28.346, -0.06}, {28.547, -0.01}, {28.747, -0.01}, {29.149, -0.01}, {29.249, 0}, {29.45, -0.01}, {29.651, -0.05}, {29.852, -0.05}, {30.053, -0.01}, {30.153, ...


1

I notice some striking similarities between this question and the following two: Calculating a sequence of functions using iteration Multiple generators for iterative construction of fractals Presumably, the user is the same, which conceals information about your mathematical and programming background - information that's useful to potential answers. ...


2

A similar thing happens in this question: How can the behavior of InterpolationOrder->0 be controlled? As @seismatica has pointed out, ListInterpolation[data, InterpolationOrder -> 0][0] yields data[[2]], not data[[1]] as might be expected. Thus the range of the interpolating function, over the fundamental domain does not include the first point in ...


3

End running the problem we can readily construct our own "zero order" interpolation function: myzero[t_] := (#[[1 + (Ceiling[Mod[t, 1] (Length@# - 1) ] )]]) &@ dataSource which gives your desired plot: ParametricPlot[myzero[t], {t, 0, 1}, AspectRatio -> Automatic] same closed figure as your InterpolationOrder-> 1 result note the ...


3

Perhaps too specific to OP's example case: Interpolation[{{{0}, 0, Automatic}, {{1}, 1, 0}, {{2}, 0, Automatic}, {{3}, 1, 0}, {{4}, 0. Automatic}}, InterpolationOrder -> 2] Plot[%[x], {x, 0, 4}] and Interpolation[{{{0}, 0, Automatic}, {{1}, 1, 0}, {{2}, 0, Automatic}, {{3}, 1, 0}, {{4}, 0. Automatic}}, ...


4

Based on What's inside InterpolatingFunction[{{1., 4.}}, <>]?, I would guess that a built-in way is not possible. However, one can take advantage of InterpolatingFunction to construct a Piecewise function. Here, split, does an overlapping partition starting a new list at position p, is a modification of Mr.Wizard's dPcore in this answer. ...


3

ParametricPlot3D and ParametricPlot accept a wide range of nested lists of expressions to specify a function or functions to be graphed. Let's discuss ParametricPlot3D. ParametricPlot is similar, with lists of length 2 replacing lists of length 3 where appropriate. There are two types of specifications List[expr,...] List[List[...],...] where expr ...


5

Even though OP's problem is resolved in the question's comments, I hope to provide an explanation of why the gap appears in the parametric plot. Namely, I think InterpolationOrder -> 0 (specifically as an option to ListInterpolation*) is the culprit, as it starts with a jump/step from the first data point to the second data point. As a result, the ...



Top 50 recent answers are included