def var(P, ax=None): A = P.A.copy() if P.dtype==f.frac: for key in P.keys: A[key] = f.var(A[key], ax) else: for key in P.keys: A[key] = np.var(A[key], ax) return Poly(A, P.dim, A[key].shape, P.dtype)
def var(P, ax=None): A = P.A.copy() if P.dtype == f.frac: for key in P.keys: A[key] = f.var(A[key], ax) else: for key in P.keys: A[key] = np.var(A[key], ax) return Poly(A, P.dim, A[key].shape, P.dtype)
def var(A, ax=None): if isinstance(A, (int, long, float, np.ndarray)): return np.var(A, ax) elif isinstance(A, f.frac): return f.var(A) elif isinstance(A, p.Poly): return p.var(A) raise NotImplementedError