# Org-Mode: Using Source Code Blocks in Table Formulas

I would like to use source code blocks in org-mode table formulas using something similar to:

#+NAME: square
#+BEGIN_SRC python :var x=0
return x**2
#+END_SRC

| 1 | 1 |
| 2 | 4 |
| 3 | 9 |
#+TBLFM: $2=$square($1)  Is there any way to accomplish this? ## 1 Answer #+NAME: sampformula #+BEGIN_SRC python :var angle=90 :var r=2 :exports none from math import radians, cos result = r*cos(radians(angle)) return result #+END_SRC | angle | r | x | |-------+----+---------------| | 30 | 10 | 8.66025403784 | | 45 | 10 | 7.07106781187 | | 60 | 10 | 5.0 | #+TBLFM:$3='(org-sbe "sampformula" (angle $1) (r$2))