# Tag Info

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

0

For MongoDB instead of using the Rest interface using urls as suggested by Mike, you can use the Java driver. Here's the proof of concept that should allow a lot of fruitful things ... I'm still amazed by the possibilities offered by JLink. Prerequisites Install MongoDB, for example on Windows ...

3

I encourage you to use the following command: Import["file_name.txt", "Table"][[All, ;;100]] It works by default with any structured data, while "Data" doesn't. And what's more important - surprisingly it works much faster than importing separated rows or columns - time difference could be the 10-100 times for huge files. And eventually it's much easier ...

7

To import the first 100 rows of the file you can use Import["myfile.data", {"Data", Range[100]}] and to import the last 100 rows Import["myfile.data", {"Data", -Range[100]}] or Import["myfile.data", {"Data", Range[-100,-1]}]

1

Use the function 'take' for example list = Import["myfile.data",{"Data",{1,2,3},All}]; Take[list1, 100] you will get the first hundred values Take[list1, {100,200)] you wil gett the values hundred until twohundred

0

myData = {{t1,x1},{t2,x2},{t3,x3}}; {t,x} = Transpose[myData]; t {t1,t2,t3} But are you seeking myFit = Fit[myData, {t^3, t^2, t, 1}, x] (for instance)?

5

I think the SelectFirst approach is probably one of the easiest to read but just for fun here are a couple of other solutions. I'll start by generating a sample table t0. t0 = RandomReal[{0, 1}, {10^5, 151}]; r0 = t0[[50000]]; Applying your method with Select is pretty fast. (Note that SelectFirst is faster for the unique case proportional to the position ...

1

Although it is not clear from the Mathematica documentation, it appears that in the default Automatic method FindClusters[] may use an iterative algorithm to partition the data set into k clusters, compute a global merit function (such as sum of inter-point distances), then randomly select a point from one randomly selected cluster and assign that point to a ...

0

data2= StringSplit /@ StringSplit[Cases[data, Cell[t_, "Input", ___] :> t, Infinity], "\n"] gives You can convert the strings to numbers using ToExpression/@data2

1

It's FinancialData["NYM:NGG15"] but most properties aren't available

2

Your data: data = {{0.067, 0.423}, {0.30, 0.408}, {0.60, 0.433}, {0.25, 0.3512}, {0.37, 0.4602}, {0.44, 0.413}, {0.60, 0.390}, {0.73, 0.437}, {0.8, 0.47}}; errors = {0.055, 0.0552, 0.0662, 0.0583, 0.0378, 0.080, 0.063, 0.072, 0.08}; ErrorListPlot[Transpose[{data, ErrorBar /@ errors}], PlotRange -> {0, 1}] Assume that the errors are distributed ...

4

For a set of data $\{t_i,A(t)\}$ its possible to define a continuous function, properly scaled, that is the Fourier transform of the data set. 1/Sqrt[n] Sum[y[[r]] Exp[(2 \[Pi] I)/n (r - 1) (s n dt)], {r, n}] Then an implementation for the absolute value of the Fourier transform could be: cxyFtM[d_, s_] := Block[{n, t, y, dt}, n = Length[d]; t = ...

1

The following approach will address the requirement Areas where the histogram is more than some threshold value... asamjson = Import["http://msi.nga.mil/MSI_JWS/ASAM_JSON/getJSON?typename=\ DateRange_AllRefNumbers&fromDate=19900101&toDate=20140801", "JSON"]; Needs["GeneralUtilities`"] asamdataset = Dataset[ToAssociations@asamjson]; asamdataset = ...

1

It is not clear to me what is the difference between FindFit and NonlinearModelFit. But NonlinearModelFit help says: And FindFit says In this case, they both indeed produce the same fit, hence both are doing least squares model = a + b/(c*x^2); nlm = NonlinearModelFit[data, model, {a, b, c}, x]; nlm["ParameterTable"] nml2 = FindFit[data, model, ...

5

The approach to address the encircling areas will be using the Graph fucntionality available in Mathematica. There are some null values in the dataset so we'll remove them in the new dataset piracyLocations. asamjson = Import["http://msi.nga.mil/MSI_JWS/ASAM_JSON/getJSON?typename=\ DateRange_AllRefNumbers&fromDate=19900101&toDate=20140801", ...

20

Some function definitions first. AkimaInterpolation[] stolen from here (Thanks JM, wherever you are!): AkimaInterpolation[data_] := Module[{dy}, dy = #2/#1 & @@@ Differences[data]; Interpolation[Transpose[{List /@ data[[All, 1]], data[[All, -1]], With[{wp = Abs[#4 - #3], wm = Abs[#2 - #1]}, If[wp + wm == 0, (#2 + #3)/2, (wp #2 + wm ...

1

Here is how I would do it. First, import the data using Import. This is straightforward from the documentation, using either Excel or txt files, so for the purposes of this exercise, I'm going to generate the data in Mathematica instead. myD = MixtureDistribution[{2, 1}, {NormalDistribution[2, 2], NormalDistribution[2, 1/2]}]; For reference, here is ...

4

Possible cause: f = OpenWrite["test.csv"]; WriteString[f, "1,2,3\n\n4,5,6\n"]; Close[f]; FilePrint["test.csv"] Through[{Length, MatrixForm}@Import["test.csv", "Lines"]] Through[{Length, MatrixForm}@ReadList["test.csv", "Record"]] Readlist doesn't count a blank line (double line ending) as a "record" while Import does You can fix this with ...

Top 50 recent answers are included