Hot answers tagged

11 votes

How to leave only specific columns?

Perhaps this: ...
Michael E2's user avatar
  • 234k
8 votes
Accepted

Perform same operation along dimension of an array

...
xzczd's user avatar
  • 65.4k
8 votes

Joining two lists element by element

Some ways of doing it: With x = {1, 2, 3}; y = {4, 5, 6}; all of the following ...
bmf's user avatar
  • 14.9k
8 votes
Accepted

Table of unequal sequence

If you want to remove specific entries, there are at least 10 ways to do it. One way could be to insert an If inside the table. Something like ...
Nasser's user avatar
  • 142k
8 votes

How to produce the following table faster?

tl;dr: As always with my post, find the most recent implementation at the bottom of the post. InterpolationFunctions are indeed much less efficient than they could/...
Henrik Schumacher's user avatar
8 votes
Accepted

How to get the list with all positions of elements matching the given combinations?

Table1 = {1,1,-1,0,0,0}; SequencePosition[Table1, {1, ___, -1} | {0, ___, 0}, Overlaps -> All] // SortBy[Last] {{1, 3}, {2, 3}, {4, 5}, {4, 6}, {5, 6}}
Syed's user avatar
  • 48.2k
8 votes

Table with a sequence:

Table[{i, If[Divisible[i, 4], i - 3, i + 1]}, {i, 1, 12}] You might also think about this as a permutation. ...
lericr's user avatar
  • 26.3k
8 votes

Evaluate a function with two lists and table

Using Transpose and Join: ...
Syed's user avatar
  • 48.2k
8 votes
Accepted

Some of the values of $f(x)$ are different from those derived by Table

Your function is discontinuous on the integers, and so it matters exactly where you are evaluating it. Numerical is not equal to analytical evaluation for discontinuous functions. ...
Roman's user avatar
  • 46.9k
7 votes

Joining two lists element by element

This is what you have (mat = {{1, 2, 3},{4, 5, 6}}) // MatrixForm And this is what you want ...
7 votes
Accepted

Bifurcation diagram for Lorenz attractor

Here is an example how you would use Sow and Reap. Note, I decreased the r interval, as I did not want to wait a long time. ...
Daniel Huber's user avatar
  • 49.9k
7 votes

Adding a summary row/column to a 2D table

Using ArrayReduce: ...
Syed's user avatar
  • 48.2k
7 votes
Accepted

Table does not give expected result with `30 but right with `40

I don't know exactly what the problem is (so it seems to be a bug), but here are a couple of workarounds: ...
Michael E2's user avatar
  • 234k
7 votes

How to get the list with all positions of elements matching the given combinations?

Select[Total @ Table1[[#]] == 0 &] @ Subsets[Range @ Length @ Table1, {2}] {{1, 3}, {2, 3}, {4, 5}, {4, 6}, {5, 6}} <...
kglr's user avatar
  • 392k
7 votes
Accepted

Table with a sequence:

Looks like you want it to be i-3 when i is divisible by 4: ...
ydd's user avatar
  • 3,653
7 votes
Accepted

How to split the table with different number of columns into those with equal number of columns?

SeedRandom[1]; tbl = Join[RandomInteger[5, {2, 2}], RandomInteger[5, {3, 4}], RandomInteger[5, {2, 3}]] ...
kglr's user avatar
  • 392k
7 votes

Evaluate a function with two lists and table

For fun ☺ = {##, f @ ##}\[Transpose] &; x~☺~y {{2, 3, 4/3}, {4, 5, 16/5}, {6, 7, 36/7}} ...
kglr's user avatar
  • 392k
6 votes

Euler's Method from Python to Mathematica

MaxStepFraction is needed if you want fewer than ten steps. ...
Michael E2's user avatar
  • 234k
6 votes
Accepted

Euler's Method from Python to Mathematica

...
Nasser's user avatar
  • 142k
6 votes

Perform same operation along dimension of an array

This a + ConstantArray[b,n] takes 7.5 seconds. However with b packed ...
user293787's user avatar
  • 11.7k
6 votes

Table of unequal sequence

With the list list = {0, 1, 2, 3, 4, 2, 9, 2, 10, 1}; you can combine FirstPosition and ...
bmf's user avatar
  • 14.9k
6 votes
Accepted

Replacing elements of one table with the elements of another table for common grid

Something along these lines might work: tab2Rules = Thread[ReplacePart[3 -> _] /@ tab2 -> tab2]; tab1 /. tab2Rules ...
lericr's user avatar
  • 26.3k
6 votes

How can I join these two tables in the following way?

MapThread[ReplacePart[#1, {5 -> Splice[#2], 6 -> Nothing}] &, {Tab1, Tab2}] or ...
lericr's user avatar
  • 26.3k
6 votes
Accepted

Can't export a table, it only export the letter

Your code is a bit weird: for one, you have a table without an iterator. Since you already know Table, use that to iterate the values of ...
MarcoB's user avatar
  • 66.6k
6 votes
Accepted

How to leave only specific columns?

If you transpose your data you can use "Cases" like: Cases[Transpose[tabtest], {"a", __}] // Transpose // MatrixForm
Daniel Huber's user avatar
  • 49.9k
6 votes
Accepted

How can I make table of variation by Mathematica like tkz-tab in LaTeX?

If the goal is to generate variation table inside the notebook, then you can do the following. I took an example using tkz-tab from the internet and just used the ...
Nasser's user avatar
  • 142k
6 votes

How to indicate table continuation in the middle with torn edge paper effect or something similar

...
kglr's user avatar
  • 392k
6 votes
Accepted

How to indicate table continuation in the middle with torn edge paper effect or something similar

It is not ultra-realistic but ... ...
Syed's user avatar
  • 48.2k
5 votes

Delete Duplicates from joining a table which has arbitrary decimal values

...
Bob Hanlon's user avatar
  • 155k
5 votes
Accepted

How to join the same table multiple times

tab2 == Join @@ ConstantArray[tab, 10] (* True *)
Roman's user avatar
  • 46.9k

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