SHARE
TWEET

Untitled

a guest Mar 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. W[n_,m_]/;f[n]==g[m]:=1
  2. W[n_,m_]/;f[n]!=g[m]:=2
  3. Table[W[n,m],{n,1,4},{m,1,4}]
  4.      
  5. W[n_,m_]/;n==g[m]:=1
  6. W[n_,m_]/;n!=g[m]:=2
  7. Table[W[n,m],{n,1,4},{m,1,4}]
  8.      
  9. n = 4;
  10. ConstantArray[1, {n, n}] + Unitize[Outer[Subtract, f /@ Range[n], g /@ Range[n], 1]]
  11.      
  12. n = 4;
  13. SparseArray[{n_, m_} /; f[n] == g[m] :> 1, {n, n}, 2]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top