Tag Info

Hot answers tagged

9

Here is one way to import the grid into Mathematica Partition[ StringCases[ Import["http://projecteuler.net/problem=11", "Plaintext"], DigitCharacter ..][[10 ;; -8]], 20] // ToExpression


9

From very old documentation (I think Mathematica 4): Parentheses within a single RowBox by default grow to span whatever other objects appear in the RowBox. Some expandable characters, however, grow by default only to a limited extent. The latter seems to apply to square brackets. But we can overcome that by using a StyleBox: StyleBox [RowBox[{"[", ...


4

Szabolcs's Past Tabular Data palette still works just like it should. This palette is so useful it is one of only two I always open on start-up. If for some reason you are looking for a one-off solution here is mine: Block[{Times = List}, (*paste here*) ] ~Partition~ 20 Reference: Convert head Times to List


3

Following the comment and your own implementation with Root it is better to define this: nthtri[t_] := Root[#^2 + # - 2 t &, 2] nthtri[28] 7 This has no unlocalized Symbols as your own version had. With your code if you set x = 5 before using it it will fail.


3

f is the function you are looking for: f[k_] := (1/2)*(-1 + Sqrt[1 + 8*k]); t[n_] := (1/2)*n*(1 + n); Table[f[t[k]], {k, 1, 10}]


2

EDIT The CoefficientRules method given below won't work if one wants to collect by patterns like Log[_] or _Log (although it will work if the stuff inside the Log is explicitly given). In this case, my instinct is that Collect is then the way to go, and the method supplied by the OP will work pretty well as it is. CoefficientRules method Variables ...


1

Why not replace # with n and take second part as your function? (x /. Solve[x (x + 1)/2 == n, x])[[2]] (*1/2 (-1 + Sqrt[1 + 8 n])*) f[n_] := 1/2 (-1 + Sqrt[1 + 8 n]) f@28 (*7*) With[{nn = 4}, Plot[f@x, {x, 0, # (# + 1)/2 &@nn}, Epilog -> {Red, PointSize[Medium], Point[Transpose@{# (# + 1)/2 & /@ Range@nn, Range@nn}]}]]


1

Highlight the list and paste into a text file and then t=Import["put path of text file in here","Table"] t//MatrixForm works for me. Does it work for anyone else?


1

What you are getting is what you told the front-end to provide. Further, it is completely equivalent to the form you want -- it's just in raw input form rather than standard input form. In fact, you can convert it to your desired form by selecting it and keying Cmnd+Shift+N (Ctrl+Shift+N on some systems).



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