Tag Info

11

As Sjoerd treacherously spoiled my answer I'm posting an interpolation (slower) version that spans a 10% larger domain: Edit The following replacement in the code below serves the same function and is much faster, but it exploits a geometric symmetry of your particular curves: bestShift[{d1_List, d2_List}] :=(x /. FindRoot[superpos[d1, d2, x], {x, -1, ...

16

Let's first make interpolations of the data: data = {data91, data88, data85, data82, data79, data76, data73, data70, data67, data64, data61, data58, data55, data52, data49}; ints = Interpolation /@ data; Now define a routine that shifts the curves in the set above the 61 deg curve so that their left-most point touches the next curve (recursively, so ...

7

Given that a list of points might be viewed a polygonal path, my answer to Equidistant points on a polyline may be applied here: With[{loop = Append[data, First@data], n = 100}, arclengths = Accumulate[Norm /@ Differences@loop]; pfn = Interpolation[ Transpose@{List /@ Rescale@Prepend[arclengths, 0.], loop}, InterpolationOrder -> 1, ...

3

Here's a different approach. It's similar to a post that was just written, then deleted (by Michael_E2, I think). Let's get a cyclic interpolation of the data: ifunc = Interpolation[({{0, Last@data}}~Join~ MapIndexed[{First@#2, #1} &, data]), PeriodicInterpolation -> True] {sol} = NDSolve[g'[t] == Norm[D[fun[t], t]] && g[1] == 0, g, ...

6

Borrowing from one of Vitaliy Kaurov's answers to Generating evenly spaced points on a curve, here is a way to get 100 points. Change the setting to Mesh to get a different number. plot = ContourPlot[x^2/4 + y^2/9 == 1, {x, -5, 5}, {y, -5, 5}, MeshFunctions -> {"ArcLength"}, Mesh -> 100]; Cases[Normal@plot, Point[p_] :> p, Infinity] (* ...

5

Here's a very inefficient way. Generate an interpolation: ifunc = Interpolation@MapIndexed[{First@#2,#1}&,data] Oversample the data: datafine = ifunc/@Range[1,Length@data,.1]; Use a rather inefficient replacement rule: datafiltered = datafine //. {h___List, a_List, b_List, t___List} :> {h, a, t} /; Norm[a - b] < ...

7

You can resample each list of coordinates (if you undersample with respect to the fine details of the curve, this won't work as well): points=40; newList=Transpose[ArrayResample[#, points] & /@ Transpose@data]; ListPlot@newList Alternatively, you can use the MeshFunctions option of ListLinePlot. ---EDIT--- Initially I thought that #3 is just arc ...

3

One very easy way is to interpolate your data matrices so that you can use them like normal functions. Let me give a simple example where data1 and data2 are supposed to be your data matrices: data1 = Table[Exp[-(x^2 + y^2)], {x, -1, 1, 2/10}, {y, -1, 1, 2/10}]; data2 = Table[2 Sin[2 x + 2 y], {x, -1, 1, 2/10}, {y, -1, 1, 2/10}]; ListPlot3D[{data1, data2}] ...

2

If you want all the local rather than just the global maximums data = Table[{i, Sin[i]}, {i, 0., 4. Pi, Pi/100.}]; peaks = data[[FindPeaks[data[[All, 2]]][[All, 1]]]] (* {{1.5708, 1.}, {7.85398, 1.}, {12.5664, 1.2865*10^-15}} *) ListLinePlot[data, Epilog -> {Red, AbsolutePointSize[6], Point[peaks]}] Note that the right boundary point is also ...

8

Fake data (next time please provide your own data) data = Table[{i, Sin[i]}, {i, 0, 4 Pi, Pi/100}]; The points with maximum ordinate ("y" value) can be found with MaximalBy and Last. MaximalBy[data, N@*Last] {{Pi/2, 1}, {(5 Pi)/2, 1}} N@*Last stands for the Composition (@*) of N and Last, i.e N[Last[#]]& To add them into your plot use Epilog ...

5

Something like this perhaps. tsm = TimeSeriesModelFit[data]; ListLinePlot[{tsm["TemporalData"], TimeSeriesForecast[Normal[tsm], data, {6}, Method -> "Kalman"]}]

5

Your text data str = "# xyscan Version 3.3.1 # Date: Wed Sep 23 11:01:55 2015 # Scanned by: dimitris # Source: /media/dimitris/E6B09AEDB09AC409/Documents and Settings/Dimitris/Documents/Prony_Math/F10.png # Comment: # Format: x y -dx +dx -dy +dy -0.20155 2.90211 0 0 0 0 0.268734 2.92958 0 0 0 0 0.802326 2.98451 0 ...

5

Assumptions No fields contain a \n or \r (true for first 7000 rows) everything is encoded in ASCII (true for first 7000 rows) Observations Some of your fields contain a , (not a problem) Some of your fields contain a \ (big problem) Your data contains the following field (in FullForm, i.e. the \ is not escaped) "PSYCHOLOGIST\CLINICAL ...

1

Let list be your list of chapter headings and page no list = {{"my first heading", 2}, {"My 2 heading",7}, {"Heading no. 3", 11}}; You can use the function given below which takes in the chapter heading as its argument and spits out the corresponding page number as listed in list f[chapterHeading_] := DeleteCases[ Flatten[Table[ ...

2

You may use TableForm (you're already using this), CellTags, NotebookLocate, and NotebookRead to do this. For your Import "Output" cell add a CellTag that will be your reference. CellPrint[ExpressionCell[ ImportString["1,2,3,4,5,6,7,8,9", "CSV"] // TableForm, "Output", CellTags -> "Data1"]] This can be re-executed at any time going forward ...

1

Here is the solution which I currently use. It isn't perfect but serves quite well for my purposes. In the Notebook I define an auxiliary function which takes a variable where a data array is stored and prints an initialization Cell with two-dimensional human-readable representation of that array which will be assigned to the input variable on ...

12

One could imagine a more detailed question (e.g. with data, and a clear statement of whether it is the upper points, or a function, that is wanted). Here is an approach to this. First set up an example. pts = RandomReal[{1, 5}, {10^4, 2}]; pts2 = Select[pts, #[[1]]*#[[2]] <= 5 &]; pts2 // Length ListPlot[pts2] We use an internal function to ...

11

This is a complementary answer, which shows mostly how to reduce memory use rather than speed (although later I might update it to address the speed issue as well). This answer is based on an undocumented functionality, so the usual warning applies: there is no guarantee that the method suggested below will work in future versions. Using undocumented ...

18

Analysis Reading the data is not the issue. I can read the data as strings quite fast. str = OpenRead["train-7000.csv"]; (data = ReadList[str, String]); // AbsoluteTiming//First (* 0.453251 *) Memory use is modest too: data // ByteCount (* 48550344 *) It's only slightly larger than the file on disk: FileByteCount["train-7000.csv"] (* 46483707 *) ...

12

A while ago I had to do some work on large amounts of timestamped magnetometer data. Although my work only recently reached the level of 500MB, you might be able to use some of these techniques on your files. Here's a sample of my CSV file with timestamp,x,y,z values 2015-06-03T22:21:30.827Z,10.5767,2.2233,-51.9933 ...

2

Using Range, Length, Nearest, Flatten, Select and MemberQ you can extract uniformly spaced log time from your uniformly spaced in time data. First an example is shown using 0.1 for the minimum time, 10.0 for the maximum time and 21 for the number of samples. Then it will be wrapped up into a function. Data is generated as in your question. y[t_] := 2 + ...

3

The algorithm does two things: Sample uniformly in log space and then convert it back to time space. Select data points in time space corresponding to the samples generated in (1). logspace from [13226] can be used for (1): logspace[increments_, start_?Positive, end_?Positive] := Exp@Range[Log@start, Log@end, Log[end/start]/increments] For step 2, ...

1

Ok here is the workaround. Actually it's the transfer of above MatLab code in Mathematica's procedural programming. Thanks to Sector, because his comments made me work harder with it!! I would appreciate now other ways of arriving in the same result which makes use of Mathematica functional or/and rule-based programming (and of course make the program ...

Top 50 recent answers are included