Tag Info

Hot answers tagged

7

You got a "D" on effort. The problem is that you haven't checked that list. A few numbers are off- After making the corrections: l = { {{16.24, 44.3486}, 642}, {{16.24, 44.3652}, 625}, {{16.24, 44.3818}, 717}, {{16.24, 44.3984}, 940}, {{16.24, 44.415}, 955}, {{16.24, 44.4316}, 798}, {{16.2566, 44.3486}, 664}, {{16.2566, 44.3652}, 820}, ...


6

This is Aitken's recursive algorithm: ClearAll["Global`*"]; f[x_] := Exp[x] (x[#] = #) & /@ Range@10; p[i_, 1][_] := f[x[i]]; p[i_, k_][xs_] := 1/(x[i] - x[k-1]) Det[{{p[k-1,k-1][xs], x[k-1] - xs}, {p[i, k-1] [xs], x[i] - xs}}] p[2, 2][x] (* 2 E - E^2 - E x + E^2 x *) r = p[9,9][x] Plot[r, {x, 1, 9}, Epilog ...


4

DataRange seems to destroy your scaling so let's get proper frame by overlaying oryginal one: dataZ = RandomReal[{1, 5}, {10, 10}]; scaleTheDomainBy10To[bx_, by_] := Module[{data1, range, range1}, data = Flatten[Table[{x*10^(bx - 1), y*10^(by - 1), dataZ[[x, y]]}, {x, 1, 10}, {y, 1, 10}], 1]; data1 = data; data1[[;; , ;; ...


3

I will address the case of an irregular grid. There are two or three ways to produce a pretty good looking plot, through rescaling/FrameTicks or through interpolation. The ticks method involves rescaling the data. This is perhaps the easiest, but the resulting plot cannot be easily combined with other plots, since the underlying coordinates have been ...


2

data = Table[{x, {Sin[x], x Cos[x]}}, {x, 0, Pi, Pi/10}]; i = Interpolation[data, InterpolationOrder -> 2]; frames = Table[ ParametricPlot[i[t], {t, 0, maxt}, AspectRatio -> 1, Axes -> None, ImageSize -> 400, AspectRatio -> 1, PlotRange -> {{0, 1.2}, {-3, 1}}, Frame -> True], {maxt, 0.2, Pi, 0.05}]; Or data = ...


2

With the functions given in the question above: Pressing the plus sign in the interpolation function object will expand the description to include the method. sol = NDSolve[eqs, {n, S}, {t, 0, 60*10^-9}, MaxSteps -> 10^6] The problem is not the iterator range but rather the initial number of PlotPoints. PlotPoints -> n specifies the total number ...


2

This question is not clear but making a few assumptions this is a direct application of the Interpolation function. data1 = {0, 1, 1, 2, 3, 3, 5, 2, 6, 2, 9, 4, 11, 5, 13, 6, 14, 7, 16, 8}; data2 = {0, 2, 1, 3, 2, 2, 3, 1, 4, 2, 6, 3, 8, 4, 9, 6, 11, 4, 16, 7}; Now assuming that the data is actually x1,y1,x2,y2,... xy1 = Partition[data1,2]; xy2 = ...


2

Update-- It turns out that a direct construction from an InterpolatingFunction does not satisfy all cases and that what is needed is a more general function interpolation. It would be nice to have a method that had some sort of automatic precision tracking. FunctionInterpolation is an apparently orphaned system function that seems to make no attempt at ...


1

I'm sure this is a duplicate but my search terms are not on target. The problem has nothing to do with NDSolve. freq[t_] := D[Exp[t], t]; Plot[freq[t], {t, 0, 20}] General::ivar: 0.0004085714285714286` is not a valid variable. >> General::ivar: 0.4085718367346939` is not a valid variable. >> General::ivar: 0.8167351020408163` is not a valid ...


1

A work-around I can think out: Clear[a, b] eqn = {m'[t] == -2 Cross[m[t], {0, 0, 1}], m[0] == {1, 0, 0}}; sol1 = NDSolve[eqn, {m}, {t, 0, 20}]; mm = m /. sol1[[1]]; m1 = mm /. {a_, b_, c_} -> a; m2 = mm /. {a_, b_, c_} -> b; freq[t_] = D[ArcTan[m1[t], m2[t]], t]; Plot[freq[t], {t, 0, 20}, AxesOrigin -> {0, 0}] If you have difficulty in ...


1

Perhaps this is enough for you: d1 = Transpose[{#[[1]] - #[[1, 1]], #[[2]]} &@ Transpose@Select[data, #[[2]] > 0 &]]; nlm = NonlinearModelFit[d1, c PDF[BetaDistribution[3, b], x], {b, c}, x]; Plot[nlm[x], {x, 0, .003}, PlotRange -> All, Epilog -> Point@d1] Another option: nlm = NonlinearModelFit[d1, c PDF[MoyalDistribution[.0002, b], ...


1

To obtain the solution to each equation as an InterpolatingFunction, use sol1 = n /. NDSolve[{n'[t] == n[t] (1 - n[t]), n[0] == 10^-5}, n, {t, 0, 20}][[1]]; sol2 = ln /. NDSolve[{ln'[t] == (1 - E^ln[t]), ln[0] == Log[10^-5]}, ln, {t, 0, 20}][[1]] Unfortunately, simply constructing Exp[sol2] to match sol1 does not work, as explained in Question 67494. A ...


1

you can work on the results as follows: f1 = n /. sol1[[1]]; f2 = ln /. sol2[[1]]; f3[x_] := Exp[f2[x]] To check the match between f1 and f3 we can plot: Plot[{f1[x], f2[x], f3[x]}, {x, 0, 20}, PlotStyle -> {Directive[Red, Dashed, Thickness[0.02]], Automatic, Black}, PlotRange -> All]


1

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 ...



Only top voted, non community-wiki answers of a minimum length are eligible