Posts

pp

#include<mpi.h> #include<stdio.h> int main(int argc,char** argv){ int rank,size,msg_send=100,msg_recv; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Comm_size(MPI_COMM_WORLD,&size); if(size<2){ if(rank==0)printf("Run with at least 2 processes.\n"); MPI_Finalize(); return 0;} if(rank==0){ printf("Process 0 sending to Process 1...\n"); MPI_Send(&msg_send,1,MPI_INT,1,0,MPI_COMM_WORLD); MPI_Recv(&msg_recv,1,MPI_INT,1,0,MPI_COMM_WORLD,MPI_STATUS_IGNORE); printf("Process 0 received from Process 1: %d\n",msg_recv);} else if(rank==1){ printf("Process 1 sending to Process 0...\n"); MPI_Send(&msg_send,1,MPI_INT,0,0,MPI_COMM_WORLD); MPI_Recv(&msg_recv,1,MPI_INT,0,0,MPI_COMM_WORLD,MPI_STATUS_IGNORE); printf("Process 1 received from Process 0: %d\n",msg_recv);} MPI_Finalize(); return 0;} #include<mpi.h> #include<stdio.h> int main(int argc,char** argv){ int rank,size,number;...

sml

import statsmodels.api as sm x1=120 n1=1000 x2=150 n2=1200 count=[x1,x2] nobs=[n1,n2] z_stat,p_value=sm.stats.proportions_ztest(count,nobs) print(f"Z-statistic: {z_stat:.4f}") print(f"P-value: {p_value:.4f}") if p_value<0.05:     print("Result: Reject the null hypothesis. There is a statistically significant difference in conversion rates.") else:     print("Result: Fail to reject the null hypothesis. No significant difference in conversion rates.") mean_a = 1000 std_a = 100 n_a = 30 mean_b = 950 std_b = 120 n_b = 30 mean_diff = mean_a - mean_b se = ((std_a ** 2) / n_a + (std_b ** 2) / n_b) ** 0.5 t_stat = mean_diff / se df_numerator = ((std_a ** 2) / n_a + (std_b ** 2) / n_b) ** 2 df_denominator = (((std_a ** 2) / n_a) ** 2) / (n_a - 1) + (((std_b ** 2) / n_b) ** 2) / (n_b - 1) df = df_numerator / df_denominator print(f"T-statistic: {t_stat:.4f}") print(f"Approximate Degrees of Freedom: {df:.2f}") if abs(t_stat) > 2.004...