Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: (Golf) Multiply polynomials

by jeroenes (Priest)
on May 11, 2001 at 13:30 UTC ( [id://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;
    }
    [list$t]}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found