Hot answers tagged

7

To formalize the comments, here is the complete code: data = {1, 2, 3, 4, 5, 6, 7, 8, 9}; weight = {5, 4, 5, 2, 4, 2, 1, 1, 1}; Last[HistogramList[WeightedData[data, weight], 9]] Which outputs {5, 4, 5, 2, 4, 2, 1, 1, 1}


6

data = Table[ PDF[BinomialDistribution[50, p], k], {p, {0.3, 0.5, 0.8}}]; DiscretePlot[ Evaluate@data, {k, 1, 50}, PlotStyle -> { Directive[Black, Opacity[.5], AbsoluteDashing[{5, 5}]], Directive[Black, Opacity[.5], AbsoluteDashing[{10, 10}]], Directive[Black, Opacity[.5], AbsoluteDashing[{0, 0}]]}, PlotMarkers -> {Automatic,...


4

You can use WeightedData[] for the purpose: FindDistributionParameters[WeightedData @@ Transpose[{{1, 11}, {2, 6}, {3, 1}, {24, 1}}], PowerDistribution[a, b], ParameterEstimator -> "MaximumLikelihood"] {a -> 0.041666666666666664, b -> 0.3657540721946402}


4

Make some sample data consisting of numbers and spaces: samepleData = Module[{seed = ToString@Table[RandomInteger[{0, 10000}], 50]}, StringReplace[seed, {"{" -> " ", "}" -> " ", "," -> RandomChoice[{" ", " ", " "}]}]] (* 7476 8829 1505 3337 7282 7244 ...


3

Usually we'll tend to fit linear system, and in this situaiton, add Log to data's y-axis will help: Log[a E^(b x)]=Log[a]+b x Truely, after this transformation, the points lay on a line~ great for fitting! It seems that this method could really do the work, so naturally, here comes the following code for fitting using normal linear fitting method: ldata ...


2

You have to use ErrorListPlots First configure the data properly. data = {{0.50, 0.23161000 10^-08, 0.22145199 10^-08}, {1.50, 0.45506399 10^-09, 0.26812801 10^-08}, {2.50, 0.12028299 10^-08, 0.25072699 10^-08}, {3.50, 0.12711100 10^-08, 0.25351401 10^-08}}; erdata = data /. {x_, y_, z_} -> {{x, y}, ErrorBar[z/10]}; Division by ...


2

Number counting approach Since your file contains (with rare exceptions) only 3 numbers on each line and the data has dimensions {400,4001,2}, it is possible to calculate how many lines you should read in order to obtain the first 40 sets out of 400. At first, some checks: data = << "EigF-V1_1.0-V2_0.000.txt"; Dimensions[data] {400, 4001, 2} ...


2

SemanticImport will handle it. Specify the column types explicitly. Example with one column: SemanticImportString[ "-5.07248931892817e-05+2.50260543778902e-18i -5.0723848172051e-05+2.870855441657444e-17i", {"ComplexNumber"} ] This returns a Dataset which you can convert to a list using Normal. Update: I can import your file without problems in ...


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


1

I'm worried that your problem is intractable because of the large number of rows in your parameter file. Processing a few rows would be no problem, where few is defined as a thousand or so. Also if you were to accumulate lists of all the target values optcost, optbud, and optq, what would you do with such long lists? Each would have 1.5M elements according ...


1

Szabolcs Horvát has a great bit of code that makes bring in tabular data via copy and paste super easy: Pasting tabular data from the web http://szhorvat.net/pelican/pasting-tabular-data-from-the-web.html



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