title: How to create matrix containing fraction numbers in numpy
body: <p>I would like to make matrix which contains fraction numbers, say 1/4, as elements.</p>
  
  <p>I made following matrix:</p>
  
  <pre><code>import numpy as np
  
  alpha = 10
  B = np.array([ [0, -0.25, -1/20, alpha/40], [1/(alpha+3), 0, -1/(alpha+3), -(alpha-1)/(alpha+3) ], [ 1/(2*alpha+2), 1/(alpha+1), 0, 1/(10*alpha+10) ], [ -1/2, -9/20, 0, 0 ] ])
  
  print(B)
  </code></pre>
  
  <p>However, the output is such:</p>
  
  <pre><code>[[ 0.   -0.25 -1.    0.  ]
   [ 0.    0.   -1.   -1.  ]
   [ 0.    0.    0.    0.  ]
   [-1.   -1.    0.    0.  ]]
  </code></pre>
  
  <p>My question is: How to keep fractions inside matrix for purpose of calculations and functions ?
  If it wasn't for variable alpha I would convert the values to decimals.</p>
  
  <p><em>EDIT</em></p>
  
  <p>The marked dublicate thread does not seem to give solution to this problem:</p>
  
  <p>Here the elements in matrix are assigned from the beginning manually. Whereas in the linked thread elements are assigned to matrix in form of equation. Which  makes things messy I think.</p>