Clear Filters
Clear Filters

Compute all third degree monomials out of a given vector

3 views (last 30 days)
Suppose you are given a vector
How can one effieciently construct a vector containing all third degree monomials of the vector entries? That is a vector of dimension containing the entries .
  5 Comments
Mohamed Abdalmoaty
Mohamed Abdalmoaty on 3 Jun 2019
Edited: Mohamed Abdalmoaty on 3 Jun 2019
Are you counting and as two different monomials? (or and ) ...These count as 1 for me.

Sign in to comment.

Answers (1)

Matt J
Matt J on 3 Jun 2019
Edited: Matt J on 4 Jun 2019
p=eps(u);
p(u<0)=-p(u<0);
logresult = nchoosek(log(u+p),2)*[3 2 1 0 ; 0 1 2 3];
result= real(exp(logresult))

Tags

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!