I need to find $dim(span(Hcap G))$ and $dim(span(Hcup G))$ where H and G are defined the following way:
I have no idea how to find the intersection/union of their null spaces and after that, I don’t know how to find the span and dim.
matrix A has sizes of 5X18, and matrix B – 8X18.
this is what i tried using the null_space of scipy, it seems like it does find the null spaces but fails in the intersection part, and I didn’t find a dedicated intersection/union function
import numpy as np
import sympy as sp
from sympy import *
from scipy.linalg import null_space
A = np.matrix([[2 ,0 ,3 ,-1 ,2 ,-1 ,6 ,-4 ,7 ,8 ,-1 ,-4 ,7 ,0 ,0 ,0 ,0 ,7 ],
[-6 ,-7 ,-9 ,10 ,1 ,10 ,-4 ,12 ,-7 ,4 ,-4 ,5 ,-7 ,0 ,0 ,0 ,7 ,0 ],
[10 ,0 ,8 ,-12 ,-4 ,-5 ,-5 ,-13 ,0 ,5 ,2 ,1 ,0 ,0 ,0 ,7 ,0 ,0],
[8 ,0 ,5 ,-4 ,1 ,-4 ,3 ,-9 ,7 ,11 ,3 ,-2 ,7 ,0 ,7 ,0 ,0 ,0 ],
[-9 ,-7 ,-3 ,8 ,5 ,8 ,1 ,11 ,0 ,-1 ,1 ,-3 ,0 ,7 ,0 ,0 ,0 ,0 ]])
B = np.matrix([[3 ,2 ,3 ,-1 ,5 ,-5 ,2 ,0 ,-3 ,5 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,2 ],
[39 ,26 ,27 ,-13 ,29 ,-25 ,-4 ,-2 ,-7 ,21 ,0 ,0 ,0 ,0 ,0 ,0 ,32 ,0 ],
[-5 ,18 ,31 ,-9 ,25 ,-5 ,12 ,-26 ,5 ,17 ,0 ,0 ,0 ,0 ,0 ,32 ,0 ,0 ],
[25 ,6 ,21 ,-3 ,19 ,-23 ,4 ,-14 ,-9 ,27 ,0 ,0 ,0 ,0 ,16 ,0 ,0 ,0 ],
[-3 ,-6 ,-3 ,1 ,-5 ,1 ,-4 ,2 ,3 ,-1 ,0 ,0 ,0 ,4 ,0 ,0 ,0 ,0 ],
[-47 ,-10 ,-35 ,5 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