
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

import numpy as np
def round_s(n, decimals= 0 ): if decimals == 0 : n_5s = n + 5 * pow( 10 , - (decimals+ 1 )) else: n_5s = n + 5 * pow( 10 , - (decimals)) if '.' in str(n_5s) and '-' in str(n_5s): return(float(str(n_5s)[ 0 :decimals+ 2 ])) elif '.' in str(n_5s) or '-' in str(n_5s): return (float(str(n_5s)[ 0 :decimals + 1 ])) else: return (float(str(n_5s)[ 0 :decimals])) def Cal_LU(D,g,ds): A=np.array((D),dtype=float) f=np.array((g),dtype=float) num_add = 0 num_sub = 0 num_div = 0 num_mult = 0 n = f.size for i in range( 0 ,n- 1 ): # Loop through the columns of the matrix for j in range(i+ 1 ,n): # Loop through rows below diagonal for each column