New answers tagged

1 vote

Using DeleteCases to delete vectors with particular index as 0

set = {{0, 1, 1, 0, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 1, 0}, {1, 0, 0, 1, 0}} Select[set, OddQ@FromDigits[#, 2] &] {{0, 1, 1, 0, 1}, {1, 0, 1, 1, 1}}
Syed's user avatar
  • 53.7k
2 votes

Using DeleteCases to delete vectors with particular index as 0

list = {{0, 1, 1, 0, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 1, 0}, {1, 0, 0, 1, 0}}; Pre-define pattern for better readability ...
eldo's user avatar
  • 69.6k
1 vote

Checking conditions of two-dimensional table

A use case of Count that's nice and readable: Count[list, {x_, y_} /; x^2 + y^2 > 5] Replace ...
Sjoerd Smit's user avatar
  • 23.5k
1 vote

Checking conditions of two-dimensional table

...
Syed's user avatar
  • 53.7k
2 votes

Checking conditions of two-dimensional table

list = {{1, 4}, {0, 7}, {0, 0}, {8, 6}, {0, 4}}; GreaterThan[Sqrt[5]] /@ Norm /@ list {True, True, False, True, True} ...
eldo's user avatar
  • 69.6k
1 vote

How to demonstrate the acceleration using spherical coordinates and spherical unit vectors?

Perhaps a bit simpler than Daniel Huber's answer: ...
Ulrich Neumann's user avatar
1 vote

How to demonstrate the acceleration using spherical coordinates and spherical unit vectors?

Assuming, you have polar coordinates: {r[t],th[t],ph[t]} as functions of time t and you want to calculate the acceleration that is defined as the second derivatives of the cartesian coordinates. With ...
Daniel Huber's user avatar
  • 51.8k
1 vote

Scalar product of vectors using dummy indices

If we take the requirements literally, with the number of vector groups being 4: ...
Goofy's user avatar
  • 2,777
0 votes

Scalar product of vectors using dummy indices

Solution depends on what your actually want to do: to compute or just to rewrite expression in nice form. Below I define few solution using replacement rules from good to very bad style. That is good ...
Acus's user avatar
  • 3,669
0 votes

How to do column vector concatenation

Mathematica doesn't distinguish row and column vectors in the way many languages do, and so the construction {{a},{b},{c}} is awkward. You would be better off defining ...
bill s's user avatar
  • 69k
3 votes

Element-wise vector-matrix exponentiation

x = {x1, x2}; A = {{1, 0}, {1, 1}, {0, 1}}; Using Table: ...
E. Chan-López's user avatar
2 votes

How to do column vector concatenation

u = {{a}, {b}, {c}}; v = {{d}, {e}, {f}}; w = {{g}, {h}, {i}}; Using Replace at level 2 ...
E. Chan-López's user avatar
2 votes

How to do column vector concatenation

u = {{a}, {b}, {c}}; v = {{d}, {e}, {f}}; w = {{g}, {h}, {i}}; Case 1 ...
user1066's user avatar
  • 18.2k
2 votes

How to do column vector concatenation

u = {{a}, {b}, {c}}; v = {{d}, {e}, {f}}; w = {{g}, {h}, {i}}; Using ReplaceAll case 1 ...
eldo's user avatar
  • 69.6k
3 votes

Element-wise vector-matrix exponentiation

x = {x1, x2}; A = {{1, 0}, {1, 1}, {0, 1}} Pick[x, #, 1] & /@ A // Map[Apply[Times]] {x1, x1 x2, x2}
Syed's user avatar
  • 53.7k
4 votes

Element-wise vector-matrix exponentiation

You can do it directly: Times @@ (x^Transpose@A) (* {x1, x1 x2, x2} *)
march's user avatar
  • 23.5k
5 votes

Element-wise vector-matrix exponentiation

Inner[ReverseApplied[Power], A, x, Times] (* {x1, x1 x2, x2} *)
user1066's user avatar
  • 18.2k
7 votes

Element-wise vector-matrix exponentiation

Times @@@ Map[x^# &, A] {x1, x1 x2, x2}
eldo's user avatar
  • 69.6k

Top 50 recent answers are included