Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: (Golf) Multiply polynomials

by jeroenes (Priest)
on May 11, 2001 at 13:30 UTC ( #79662=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    use PDL:
    sub p{$t=pdl+pop;$t=$t*(pdl$_)for@_;[list$t]}
  2. or download this
    print join " ", @{p([1..5],[1..5])}; 
    1 4 9 16 25
  3. or download this
    sub p{my $t=pdl+pop;$t=$t*(pdl$_)for@_;[list$t]}
  4. or download this
    A = p1'*p2;
    product = crossdiags(A);
  5. or download this
    sub p{$t=pdl+pop;for(@_){
      my $a=outer$t,pdl+pop;
      $t->slice("$_:".($_+$n))+=$a->slice("$_,:")for 0..$n;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79662]
[TCLion]: I guess it makes sense but trying to take out key info to make it general was a bit difficult in the tiny window, it just doesnt look right... but I understand

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2017-03-23 19:01 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (294 votes). Check out past polls.