New answers tagged syntax
1
vote
How to check if the given row matches one of the rows of a table?
KeyExistsQ[Counts[tabb],rowThere]
KeyExistsQ[Counts[tabb],roww]
(*
True
False
*)
Data/Lists
...
3
votes
How to check if the given row matches one of the rows of a table?
Another alternative is to use Union:
...
1
vote
How to check if at least one ordering of the given row matches one of the rows of a table?
My attempt is as follows:
MatchesRowQ[table_, row_] := MemberQ[table, #] & /@
Permutations[row, Length[row]] // Or @@ # &
...
1
vote
How to check if at least one ordering of the given row matches one of the rows of a table?
Or @@ Map[ContainsAll[roww], tabb]
Some examples
...
2
votes
How to check if at least one ordering of the given row matches one of the rows of a table?
containsInAnyOrder = Not @ FreeQ[{OrderlessPatternSequence @@ #2}] @ # &;
3
votes
Accepted
How to check if at least one ordering of the given row matches one of the rows of a table?
MemberQ[Sort /@ tabb, Sort[roww]]
3
votes
How to check if the given row matches one of the rows of a table?
SeedRandom[1];
tabb = RandomInteger[{0, 4}, {5, 4}]
row = {0, 3, 4, 4}
ContainsAny[tabb, {row}]
True
5
votes
Accepted
How to check if the given row matches one of the rows of a table?
tabb = RandomInteger[{0, 4}, {5, 4}];
row = RandomInteger[{0, 4}, 4];
Well, it's simply
MemberQ[tabb, row]
returning ...
2
votes
Replacing elements of one table with the elements of another table for common grid
Values @ AssociationThread[Most /@ #, #] & @ Join[tab1, tab2]
...
2
votes
1
vote
Replacing elements of one table with the elements of another table for common grid
My attempt to do this, defining ReplaceByCoords:
...
3
votes
Replacing elements of one table with the elements of another table for common grid
Using Association - overwriting
Join @@ Values @ Association[GroupBy[Most] @ tab1, GroupBy[Most] @ tab2]
{{0.5, 0.1, 0.05}, {0....
8
votes
Accepted
Reverse the rotation of an animated gif and create a mirror image of it
To keep same speed for GIF import its "DisplayDurations":
dur = Import["/Users/Vitaliy/Desktop/wheel.gif", "DisplayDurations"]
And ...
5
votes
Reverse the rotation of an animated gif and create a mirror image of it
The idea is rotate the matrix(rotate 90 Degree), that is
...
2
votes
Accepted
How to automatically convert sub- super-indices to strings?
How did you get something like expr in the first place? It's probably much easier to produce "m_t" from a step earlier in the process. Anyway, from @...
1
vote
How to automatically convert sub- super-indices to strings?
For your specific example,
expr = Subscript[m, t];
ToString[expr[[1]]] ~~ "_" ~~ ToString[expr[[2]]]
does the trick. For a more complicated example, ...
1
vote
Clip, Select, FirstPosition not working for extracting values from an association based on a range from another list
This is pretty jenky, but I think it gives you what you're asking for.
...
2
votes
Splicing a list of arguments into a function with Sequence
Another way is to delete the Head with
Delete
...
1
vote
Accepted
Clip, Select, FirstPosition not working for extracting values from an association based on a range from another list
You should eliminate the curly brackets:
dt = <|data|>
<|"A" -> "2017011_230833",
"X" -> {7.96439, 7.85037, 18.128, 6....
1
vote
Splicing a list of arguments into a function with Sequence
Another way to do this is to use Replace for the particular position the array has in your example:
...
3
votes
Accepted
Splicing a list of arguments into a function with Sequence
Splice came with V 12.1:
array = {e, f};
foo[a, b, c, d, Splice[array, foo]]
foo[a, b, c, d, e, f]
If we ...
2
votes
3
votes
How to leave only specific columns?
dt = MapApply[#1 -> {##2} &] @ Transpose[tabtest];
Lookup[#, "a", Nothing] & /@ dt // Transpose // MatrixForm
5
votes
5
votes
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
11
votes
1
vote
How to take the beginning and end parts of a list with simpler syntax?
Another way using Cases:
...
3
votes
How to take the beginning and end parts of a list with simpler syntax?
With ReplaceAt (since 13.1):
ReplaceAt[Range[10], _ -> b, {{;; 3}, {7 ;;}}]
{b, b, b, 4, 5, 6, b, b, b, b}
4
votes
How to take the beginning and end parts of a list with simpler syntax?
Using TakeList: (introduced 14 Sep 2017)
alist = Range[10];
Examples
...
Top 50 recent answers are included
Related Tags
syntax × 985list-manipulation × 100
functions × 83
plotting × 66
function-construction × 64
calculus-and-analysis × 44
programming × 44
equation-solving × 43
differential-equations × 36
evaluation × 34
performance-tuning × 33
core-language × 29
compile × 28
symbolic × 26
numerical-integration × 24
matrix × 23
replacement × 22
warning-messages × 21
symbols × 19
custom-notation × 18
simplifying-expressions × 17
operators × 17
mathematical-optimization × 16
front-end × 16
expression-manipulation × 16