Skip to main content
9 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

Use Inner Inner[Power, var, #, Times] & /@ expo (* {x[1],x[2],x[3] x[4],x[2] x[5]} *)
A. Kato's user avatar
  • 2,960
8 votes
Accepted

Generate vectors with a certain property

Solution without recursion. gen[n_Integer?Positive] := FoldList[#2 (#1 + #2) &, 0, #] & /@ Tuples[{0, 1}, n - 1] For ...
Edmund's user avatar
  • 43.1k
7 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

This feels like I was just following the directions in the OP: Times @@ (var^#) & /@ expo
Michael E2's user avatar
  • 241k
4 votes

Issue with variable within Sum[] bounds

There appears to be a closed-form solution for specified values of $n$. I haven't found the general formula for when $n$ is some positive integer. Here are the results for $n=1, 2,\ldots,8$. (Note ...
JimB's user avatar
  • 42.4k
4 votes
Accepted

How to find intersecting linear equations between two lists?

Can intersect using Intersection once all right-hand-sides are zero. Just use Together on the quotient of left-hand-sides as the ...
Daniel Lichtblau's user avatar
4 votes

Generate vectors with a certain property

This calls for a recursive function. ...
Daniel Huber's user avatar
  • 54.6k
4 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

Here is another Inner strategy: Inner[OperatorApplied[Power], expo, var, Times]
lericr's user avatar
  • 31.7k
3 votes

How to find intersecting linear equations between two lists?

Follow the idea by @Daniel Lichtblau ( +1 ); Using RegionEqual( or ForAll[{x, y}, Equivalent[expr1, expr2]] // Resolve); ...
cvgmt's user avatar
  • 79.8k
3 votes

How to find intersecting linear equations between two lists?

Reduce the list SubtractSides/@List@@FullSimplify[Reduce[Or@@Join[list1,list2]]] (* {x + 2 y == 0, 3 x - y == 0, 3 x - 2 y == 0, x - y == 0} *) Sort by slope <...
rhermans's user avatar
  • 37k
3 votes

How to find intersecting linear equations between two lists?

To get an overview, draw a picture: ...
Daniel Huber's user avatar
  • 54.6k
3 votes

How to optimize performance with DeleteDuplicates?

I build upon A. Kato's idea to use a normalization: First turn each element into a unique representative of the equivalence class. Then run vanilla DeleteDuplicates....
Henrik Schumacher's user avatar
3 votes

How to optimize performance with DeleteDuplicates?

This answer is for the case where the order does matter. While OP's question asks for case where the order does not matter at any level. First of all rules can be ...
azerbajdzan's user avatar
  • 21.4k
2 votes

How to implement this zip function? zip[g,{f[{a,b}],f[{c,d}]}] to f[{g[{a,c}],g[{b,d}]}]

Inspired by @E. Chan-López and @Tapiocaweasel's answers, another variant is: zip[h_, expr : {f_[__] ..}] := f[h /@ Thread[{##}[[1]] & @@@ expr]]
L. G. Romero's user avatar
2 votes

How to implement this zip function? zip[g,{f[{a,b}],f[{c,d}]}] to f[{g[{a,c}],g[{b,d}]}]

A variant of the @Edmund's answer is as follows: zip[h_, expr : {f_[__] ..}] := expr[[1, 0]][h /@ Thread[Splice@*List @@@ expr]] zip[g, {f[{a, b}], f[{c, d}]}] <...
E. Chan-López's user avatar
2 votes

How to implement this zip function? zip[g,{f[{a,b}],f[{c,d}]}] to f[{g[{a,c}],g[{b,d}]}]

Your case is very specific and as such the affect can be achieved with MapApply and Part. ...
Edmund's user avatar
  • 43.1k
2 votes

How to find intersecting linear equations between two lists?

Something bland (as equations are linear 2D: ...
ubpdqn's user avatar
  • 63.1k
2 votes

Standalone Table Invocation Using NextPrime to Generate Sequence of Division of Integers

Your description doesn't match you expected result. This reproduces your expected result: Divide @@ Comap[{#*2 &, Prime}][Range[10]] Since you asked ...
lericr's user avatar
  • 31.7k
2 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

expo . Log@var // Exp (* {x[1],x[2],x[3] x[4],x[2] x[5]} *)
Karl's user avatar
  • 958
1 vote

Issue with variable within Sum[] bounds

It's not really an answer. I think that does not have finite closed-form expression in terms of very large class of special functions. ...
Mariusz Iwaniuk's user avatar
1 vote
Accepted

Transforming an expression into function

This is because Plot, like other similar functions such as Sum or Do, localizes its variable ...
att's user avatar
  • 321
1 vote

Standalone Table Invocation Using NextPrime to Generate Sequence of Division of Integers

Table[Prime[n]/(2 n), {n, 1, 10}] NestList[NextPrime[Numerator[#]]/(Denominator[#] + 2) &, 3/4, 8] $$\left\{1,\frac{3}{4},\frac{5}{6},\frac{7}{8},\frac{11}{...
azerbajdzan's user avatar
  • 21.4k
1 vote
Accepted

Standalone Table Invocation Using NextPrime to Generate Sequence of Division of Integers

[extended comment] It's difficult to figure out exactly what you're asking. If you want Table specifically to perform operations on previous intermediate results, ...
lericr's user avatar
  • 31.7k
1 vote

Insert several rows and problem with Return

Using ReplacePart and Extract: ...
L. G. Romero's user avatar
1 vote

Insert several rows and problem with Return

m = Table[i*(j + 2), {i, 3}, {j, 3}]; v1 = Range[10, 12]; v2 = Range[20, 22]; Using Fold: ...
E. Chan-López's user avatar

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