molekyla777
• Member for 7 years, 11 months
• Last seen more than a month ago

Use this: f = Compile[{{lst, _Real, 2}, {val, _Real, 1}}, First@First@Position[lst, val]]; f[samplelist, {1, 3}] (*3*)

If you use MMA 10 try DSolveValue instead of DSolve. In this case may help this: (*extracting expressions from Function*) t = Solution /. func_Function :> func[[2]]; (*extracting expressions from ...

Try this: t = Import["c:\\work\\temp\\1.xyz"]; allColors = {}; (*get all colors from Graphics3D*) Scan[If[MatchQ[#, RGBColor[__]], AppendTo[allColors, #]] &, t, Infinity]; allColors = ...

Use Map: table = (Most[#] -> Last[#])& /@ arr

With MMA10 this can be done by this code: DeleteDuplicates /@ GroupBy[Transpose@{L1, L2}, First -> Last] (*<|1 -> {2}, 2 -> {3, 1}, 3 -> {0}, 0 -> {0}|>*)

In MMA10 this can be done with TimeSeriesWindow EDIT Here base version of TimeSeriesWindow for MMA9 SelectBetweenDates[financialData_,{startDate_,endDate_}]:=Select[financialData,AbsoluteTime[...

This may help: locations=RandomInteger[{-10,10},{4,2}]; holes=RandomInteger[{-10,10},{4,2}]; ListPlot[{locations, holes}, PlotLegends -> {"locations", "holes"}] distanceFunc = Nearest[holes, ...

Here is elegant way. Not fast but pretty func[lst1_List, lst2_List] := Module[{f1, f2, x}, SetAttributes[f1, Orderless]; SetAttributes[f2, Orderless]; f1[x__] := x; f2[x__] := x; TrueQ[{f1 @...

For plotting circles more natural use polar coordinate system: P1 = {Sqrt[2]/2, Sqrt[2]/2}; P2 = {-1, 0}; theta1 = ArcTan @@ P1; theta2 = ArcTan @@ P2; PolarPlot[1, {r, theta2, theta1}, PlotRange -&...

covert your spherical parametrized curve into cartesian parametrized curve with formulas: \begin{cases} x&=r\sin\theta\cos\varphi\\ y&=r\sin\theta\sin\varphi\\ z&=r\cos\theta \end{cases}...

I think you have deal with Mathematica application. I know 2 way for solv this problem 1) Add path to your application in variable $Path. And then load with Get AppendTo[$Path,"C:\\path\\to\\your\\...

If your computation in each cycle takes little time there is no reason for paralleling this cycle. Prove: ParallelTable[i, {i, 1, 1000000}]; // AbsoluteTiming (*8 cores*) (*{0.449026, Null}*) Table[i,...

First of all avoid using For loop better (and faster) use Do instead. stream = OpenWrite["c:\\1.txt"]; Do[ z = Exp[x^2]; Write[stream, z] , {x, 0, 100000, 0.5}]; Close[stream]; PS: it is best ...

All function you need it's DistributeDefinitions and ParallelTry f1 := RandomInteger[{1, 24}] + RandomInteger[{1, 24}]; func[x_] := While[True, If[f1 === 2, Print["snake eyes"]; Return[...

Approach using v10 functions: CustomMerge1[lists__] := Module[{assocList, keys, vals, res}, assocList = GroupBy[#, First -> Rest] & /@ {lists}; keys = Sort@DeleteDuplicates[Flatten[Keys /...

There is undocumented function which return working (temporary) and target CCompilerDirectories[] (*{C:\Users\Александр\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Windows-x86-64,C:\...

Suppose input data is: lst = {{2, 4, 6, 8, 9}, {342432, 435345, 564564, 56756, 9945}, {23, 356, 565, 304, 564}, {3, 67, 76, 44, 7}} then using following code give 3 plots ListLinePlot[MapThread[...

More genaral approach: Flatten@Riffle[{a, b, c, d, e, f, g}, Transpose@{{1, 2, 3}, {x, y, z}}] (*{a, 1, x, b, 2, y, c, 3, z, d, 1, x, e, 2, y, f, 3, z, g}*)

Use MemoryConstrained MemoryConstrained[yourCode, memoryLimit, actionOnMemoryLimitOverflow]

I don't know why, but replacing Switch with nested If solved the problem of leaking memory.

Small advice: use Missing[] instead of whitespace character. And dataset look better PS: if you have deal with time series probably better use TemporalData or TimeSeries

Use ToString Do[ Export[yourPathToFile<>ToString[i+20]<>".csv", yourData[[i]]] ,{i,0,22}

EDIT Forgot for LogPlot. Firs of all read about tangent line. Then try to uderstand how work function getTangentVectAtValue func[t_]:=(1-t)^(-0.5); getTangentVectAtValue[func_,xValue_,vectLen_]:={{...

First of all read a help. It's say: Interpolation[{{{x1, y1, ...}, f1}, {{x2, y2, ...}, f2}, ...}] constructs an interpolation function of multidimensional data. Your data have form {{x1, y1, f1}...

Use Replace with levelspec = 1 createArray[array_, n_] := Composition[ Flatten[#, 1] &, Replace[#, x_ :> ConstantArray[x, n], 1] & ][array] Check function: createArray[{{a},{b},...

Let's denote values {t, f(t)} as F, then interpolate this array with ListInterpolation. fx = ListInterpolation[F[[All, 2]], {F[[1, 1]], F[[-1, 1]]}] Now we may use Integrate with fx Integrate[Sin[...

It's not answer but comment Code k Esc.Esc k Esc.Esc k //. {k Esc.Esc k -> k} does not work becouse FullForm[k Esc.Esc k Esc.Esc k] (*CenterDot[k,k,k]*) and you try replace CenterDot[k,k] (...