Tag Info

New answers tagged

1

This feels quite a bit like an odd mix of systems of distinct representatives and block designs, although this exact problem isn't coming to mind as a particular construction in any of these combinatorial contexts. It would probably help to pull out a book about matroids too -- that's not my forte either. It's important to note that all of your sets will be ...


2

It seems to me that this is a special case of a graph connectivity situation. That is, the individual elements in foo can be seen as vertices, while foo[[i]] for i=1,2,3 can be seen as layers in a (directed) net. This can be visualized as: foo = {{a, b}, {c, d, e, f}, {x, y}}; edges = UndirectedEdge @@ # & /@ Flatten[Tuples /@ Partition[foo, 2, 1], 1]; ...


1

With data your time series and t your interval, e.g., {t1,t2}, the maximum time event in your interval is given by: TimeSeriesWindow[data,t]["Path"][[-1]]


3

Here's general approach, which I primarily show in order to give an answer that includes the Neville-Aitken algorithm. It peculiarly works from the bottom of the triangle up, that is $T_k^{(n)}$ or t[k, n] are generated in the order shown in the table: One of the distinctions to make clear is whether the function $f$ in the recursion ...


10

In this answer, I will use the Functional Paradigm to deal with triangular recursive formula in a uniform manner. For the triangular recursive formula $$T_k^{(n)}=f(T_{k-1}^{(n)},T_{k-1}^{(n+1)})$$ In general, $f(x)=a x+b$, so the triangular recurisive formula can be denoted as below: $$T_k^{(n)}=\alpha(k,n) T_{k-1}^{(n)}+\beta(k,n)T_{k-1}^{(n+1)}$$ ...


4

Here's a straightforward implementation of the formulas posted in the question. Clear[t, s, c, r]; t[f_, {a_, b_}, n_] := (b - a)/(2 n) * ReplacePart[ConstantArray[2, n + 1], {1 -> 1, n + 1 -> 1}] . (f /@ Rescale[Range[0, n], {0, n}, {a,b}]) s[f_, {a_, b_}, n_] := (4^1 t[f, {a, b}, 2 n] - t[f, {a, b}, n])/(4^1 - 1); c[f_, {a_, b_}, n_] := (4^2 ...


1

This is a very literal way of doing precisely what you described: f[arr_] := Sequence[Prepend[arr, 1], Prepend[arr, 0], Prepend[arr, -1]] f /@ {{1, 1}, {0, 1}, {-1, 1}} You can think of Sequence[a,b,c] as representing a,b,c without any other expression surrounding them.


0

Just for variety: f[s_] := ({#, Sequence @@ s} & /@ Range[-1, 1]); g[lst_] := Join @@ (f /@ lst); So, test = {{1, 1}, {0, 1}, {-1, 1}}; g[test] gives: (*{{-1, 1, 1}, {0, 1, 1}, {1, 1, 1}, {-1, 0, 1}, {0, 0, 1}, {1, 0, 1}, {-1, -1, 1}, {0, -1, 1}, {1, -1, 1}}*) and can be nested: Nest[g, test, 2] gives: (*{{-1, -1, 1, 1}, {0, -1, 1, 1}, ...


1

(Flatten /@ Reverse /@ Tuples[{#, {-1, 0, 1}}]) & @ {{1, 1}, {0, 1}, {-1, 1}} {{-1, 1, 1}, {0, 1, 1}, {1, 1, 1}, {-1, 0, 1}, {0, 0, 1}, {1, 0, 1}, {-1, -1, 1}, {0, -1, 1}, {1, -1, 1}} Nest[ (Flatten /@ Reverse /@ Tuples[{#, {-1, 0, 1}}]) & , {{1, 1}, {0, 1}, {-1, 1}}, 2] {{-1, -1, 1, 1}, {0, -1, 1, 1}, {1, -1, 1, 1}, {-1, 0, 1, ...


3

Nice to meet you, Mr Shu. Bug fix first. Your function doesn't work under desired precision because: Table[trapezium[func, 2^i, {a, b}], {i, 0., iter}] Changing it to Table[trapezium[func, 2^i, {a, b}], {i, 0, iter}] still doesn't fix the problem, because all the numbers taking part in the calculation all have infinity precision then. Adding a ...


3

Here is old HW assignment. The code is not very functional at all. I even use Break[] in there (OMG!) , but I get same result as the table in the book shows. I put them side-by-side with the magic of cut/paste: Code: nmaRomberg[c_] := Module[{len = Length[c], r, k = 1, f, j, i}, r = Table[0, {len}, {len}]; r[[All, 1]] = c; Do[ k++; f = ...


2

I haven't yet tried to imagine an algorithm for your problem but here is a visualization that might help you approach it. pairs[ls_List] := Join @@ Tuples /@ Subsets[ls, {2}]; plot[ls_List, set_List] := ArrayPlot[ Outer[SubsetQ, set, pairs @ ls, 1] // Boole, FrameTicks -> All, FrameLabel -> {"Tuples", "Pairs"} ] If you are not using ...


5

Hyperbolic lines in the Poincare disk are arcs of circles which, if extended, would meet the unit circle boundary orthogonally. Tiling the disk requires reflection of a tile's vertices and circular edges in those same circular edges. This corresponds to inversion in a circle. Begin with a central polygon having p edges, with q such polygons meeting at each ...



Top 50 recent answers are included