• V1.6 6be38cd51b

    hliu092 released this 2026-11-24 07:13:25 +00:00 | 0 commits to main since this release

    The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/06

    Introduction: This model designs a 3D numerical modeling of chemistry reaction rate by adopting the three-dimensional arrays. The [0,1] binary algorithm is used to simulate the probability of molecule occurrence in the spatial grids of this 3D model. Active chemistry bond is taken into consideration in the functions calculating the chemistry reaction rate.
       
    Development language: C++;

    All Rights Reserved.

    Reference: Liu Huan (2025). Fundamental mechanics: from classical mechanics to quantum mechanics and its application on quantum chemistry. Journal of Quantum Physics and Materials Chemistry (ISSN2958-4027). 2025 (09). https://doi.org/10.58473/JQPMC0014

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID. (5f33d940332da53ba65f2c1975ab960fc5e66fcf76e352848887a4a5ee03946d); Register Time: 2025-11-12 11:25.

    Source Code:
    //All rights reserved by Liu Huan; Source from: https://doi.org/10.58473/JQPMC0014

    #include <iostream>
    #include <random>
    #include <vector>
    #include <iomanip>
    #include <algorithm>

    using namespace std;

    const double E=0.005, F=0.003;
    vector<vector<vector>> generateArray(int I, int J, int K, double probability) {
    random_device rd;
    mt19937 gen(rd());
    uniform_real_distribution<> dis(0.0, 1.0);

    vector<vector<vector<int>>> arr(I, vector<vector<int>>(J, vector<int>(K)));
    for (int i = 0; i < I; i++) {
        for (int j = 0; j < J; j++) {
            for (int k = 0; k < K; k++) {
                arr[i][j][k] = (dis(gen) < probability) ? 1 : 0;
            }
        }
    }
    return arr;
    

    }

    int countOnes(const vector<vector<vector>>& arr) {
    int count = 0;
    for (const auto& layer : arr) {
    for (const auto& row : layer) {
    for (int val : row) {
    if (val == 1) count++;
    }
    }
    }
    return count;
    }

    void printArray(const vector<vector<vector>>& arr) {
    for (int i = 0; i < arr.size(); i++) {
    cout << "Layer " << i << ":" << endl;
    for (int j = 0; j < arr[0].size(); j++) {
    for (int k = 0; k < arr[0][0].size(); k++) {
    cout << arr[i][j][k] << " ";
    }
    cout << endl;
    }
    cout << endl;
    }
    }

    int main() {
    double Density1, Density2, P1, P2;
    int I, J, K, T;

    cout << "To input the decimal values (0.00) of Density1 and Density2 (leaving a space in the middle): ";
    cin >> Density1 >> Density2;
    cout << "To input the integral values of I, J, K (leaving a space among values): ";
    cin >> I >> J >> K;
    cout << "To input the time intervals T: ";
    cin >> T;
    cout << "To input the value of P1 and P2 (leaving a space in the middle): ";
    cin >> P1 >> P2;
    
    vector<vector<vector<int>>> final_c;
    int total_Reaction = 0;
    double final_Density1 = Density1, final_Density2 = Density2;
    
    for (int iter = 0; iter < T; iter++) {
        auto a = generateArray(I, J, K, P1 * Density1);
        auto b = generateArray(I, J, K, P2 * Density2);
        
        vector<vector<vector<int>>> c(I, vector<vector<int>>(J, vector<int>(K)));
        for (int i = 0; i < I; i++) {
            for (int j = 0; j < J; j++) {
                for (int k = 0; k < K; k++) {
                    c[i][j][k] = a[i][j][k] * b[i][j][k];
                }
            }
        } 
        
        int Reaction = countOnes(c);	
        total_Reaction += Reaction;
    	Density1 = std::max(0.0, Density1 - E * Reaction);
    	Density2 = std::max(0.0, Density2 - F * Reaction);
        
        if (iter == T - 1) {
            final_c = c;
            final_Density1 = Density1;
            final_Density2 = Density2;
        }
    }
    
    cout << "\nThe " << T << " Times cycle:" << endl;
    cout << "c[i][j][k]:" << endl;
    printArray(final_c);
    cout << "Total products (from the first time interval to the " << T << " times time interval): " << total_Reaction << endl;
    cout << "Updated Density1: " << fixed << setprecision(2) << final_Density1 << endl;
    cout << "Updated Density2: " << fixed << setprecision(2) << final_Density2 << endl;
    
    return 0;
    

    }

    Downloads
  • V1.5 6be38cd51b

    hliu092 released this 2026-11-24 07:11:36 +00:00 | 0 commits to main since this release

    The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/05

    Introduction: My previous modeling project simulate the net primary production process by using Vensim software. In order to improve it, modeling of net primary production (NPP) is also conducted by using C++ language with specific improvement discussed.

    Development language: C++;

    All Rights Reserved.

    Reference: Liu Huan (2024). Original Review of Biodiversity Conservation Progress in China: The Theories and Cases in Practice. Journal of Environment and Health Science (ISSN 2314-1628). 2024(04). https://doi.org/10.58473/JEHS0012

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID. (2a6313a6252f4a61ea5865652b9113e8ace73fdfcc9d7fed88904d8de5441b14) ; Register Time: 2025-11-11 09:55.

    Source Code:
    // @All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JEHS0012
    #include <iostream>
    #include <cmath>
    #include <vector>
    using namespace std;
    int main() {
    // Definition of Variables;
    double NPP, APAR, LUE, WLF, FPARA, LU, RPAR;
    vector DR(90), FPARA_daily(90), VDR(90);
    double TDR, WB, Precipitation, E, Ev, Kv, LSP;
    double a, s, r;
    int V, P, n;

    cout << "=== Calculator of NPP for multiple plant species ===" << endl;
    
    // To input the species amount;
    cout << "Please input the species amount n (integer): ";
    cin >> n;
    
    // To input the water balance parameters;
    cout << "Please input the parameter a: ";
    cin >> a;
    cout << "Please input the parameter s: ";
    cin >> s;
    cout << "Please input the parameter r: ";
    cin >> r;
    
    // To input the LSP, V, P;
    cout << "Please input the parameter LSP: ";
    cin >> LSP;
    cout << "Please input the parameter V (integer): ";
    cin >> V;
    cout << "Please input the parameter P (integer): ";
    cin >> P;
    
    // To input the RPAR, Precipitation;
    cout << "Please input the parameter RPAR: ";
    cin >> RPAR;
    cout << "Please input the parameter Precipitation: ";
    cin >> Precipitation;
    
    // To input the variable of Percentage;
    vector<double> Percentage(n);
    cout << "\n Please intut " << n << " species' Percentage:" << endl;
    for(int i = 0; i < n; i++) {
        cout << "Percentage[" << (i+1) << "]: ";
        cin >> Percentage[i];
    }
    
    // To input the 90 days' DR;
    cout << "\n Please input 90 days' DR: " << endl;
    for(int i = 0; i < 90; i++) {
        cout << "The" <<" "<<(i+1) <<" "<< "day's DR: ";
        cin >> DR[i];
    }
    
    // To input the 90 days' FPARA;
    cout << "\n Please input 90 days' FPARA: " << endl;
    for(int i = 0; i < 90; i++) {
        cout << "The" <<" "<< (i+1) <<" "<< "day's FPARA: ";
        cin >> FPARA_daily[i];
    }
    
    // To input m value under P types of different pressure;
    vector<double> m_values(P);
    cout << "\n Please input " << P << " amount of m value:" << endl;
    for(int i = 0; i < P; i++) {
        cout << "m[" << (i+1) << "]: ";
        cin >> m_values[i];
    }
    
    // To calculate the final m that is the sum of m values (in total P amount);
    double m = 0;
    for(int i = 0; i < P; i++) {
        m += m_values[i];
    }
    
    // To input Kv value under V types of different frequencies;
    vector<double> Kv_values(V);
    vector<double> Ev_values(V);
    cout << "\n Please input " << V << " amount of Kv values: " << endl;
    for(int i = 0; i < V; i++) {
        cout << "Kv[" << (i+1) << "]: ";
        cin >> Kv_values[i];
    }
    
    // To calculate VDR;
    for(int i = 0; i < 90; i++) {
        if(DR[i] > LSP) {
            VDR[i] = LSP;
        } else {
            VDR[i] = DR[i];
        }
    }
    
    // To calculate LU;
    LU = 0;
    for(int i = 0; i < 90; i++) {
        LU += VDR[i] * FPARA_daily[i];
    }
    
    // To calculate TDR;
    TDR = 0;
    for(int i = 0; i < 90; i++) {
        TDR += DR[i];
    }
    
    // To calculate WB and WLF;
    WB = (a * Precipitation) / (s * TDR / (s + r));
    if(WB > 1) {
        WLF = 1;
    } else {
        WLF = WB;
    }
    
    // To calculate Ev and E;
    double Ev_sum = 0;
    for(int i = 0; i < V; i++) {
        Kv = Kv_values[i];
        Ev_values[i] = exp(-Kv * m);
        Ev_sum += Ev_values[i];
    }
    
    E = Ev_sum / V;
    
    // To calculate LUEn and LUE;
    vector<double> LUEn(n);
    LUE = 0;
    for(int i = 0; i < n; i++) {
        // To input the LUE parameters for each species;
        cout << "\n Please input the " << (i+1) << " species' LUE parameters: " << endl;
    double y0, a0, x0, b0;
    cout << "y0[" << (i+1) << "]: ";
    cin >> y0;
    cout << "a0[" << (i+1) << "]: ";
    cin >> a0;
    cout << "x0[" << (i+1) << "]: ";
    cin >> x0;
    cout << "b0[" << (i+1) << "]: ";
    cin >> b0;
    
    double ln_value = log(E / x0) / b0;
    LUEn[i] = y0 + a0 * exp(-0.5 * pow(ln_value, 2));
    LUE += LUEn[i] * Percentage[i];
    }
    
    // To calculate APAR and NPP;
    APAR = LU * RPAR;
    NPP = APAR * LUE * WLF;
    
    cout << "\n=== final results ===" << endl;
    cout << "Net Primary Production (NPP): " << NPP << endl;
    
    return 0;
    

    }

    Downloads
  • V1.4 6be38cd51b

    hliu092 released this 2026-11-24 07:09:20 +00:00 | 0 commits to main since this release

    The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/04

    Introduction: To order to analyze the succession pattern among different plant communities, my previous article has adopt the sampling method specifically aiming to characterize the frequency-size relations between sample plots, which is calculated by Bray-Curtis Dissimilarity index. The underlying theory with regards to the inter-species relationship is discussed correspondingly in detail; my previous article has also tried to improve the traditional knowledge of Hardy Weinberg's Equiliberum Law, by taking the factors of intra-species relationship and geographic separation into consideration. To simulate this process of newly proposed theory, this modeling project designs the model of plant molecular evolution.

    Development language: C++;

    All Rights Reserved.

    Reference: Liu Huan (2024). Original Review of Biodiversity Conservation Progress in China: The Theories and Cases in Practice. Journal of Environment and Health Science (ISSN 2314-1628). 2024(04). https://doi.org/10.58473/JEHS0012

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID. (2a6313a6252f4a61ea5865652b9113e8ace73fdfcc9d7fed88904d8de5441b14) ; Register Time: 2025-11-11 09:55.

    Source Code:
    //@ All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JEHS0012;
    #include <iostream>
    #include <vector>
    #include <map>
    #include <iomanip>
    #include <tuple>
    using namespace std;
    int main() {
    int I, J, K, N, S;
    const double D=1.00; double E=0.30; double F=0.50;
    cout << "=== Ecological Distribution Modeling ===" << endl;
    cout << "Input the longitude grid scale (I): ";
    cin >> I;
    cout << "Input the latitude grid scale (J): ";
    cin >> J;
    cout << "Input the altitude grid scale (K): ";
    cin >> K;
    cout << "Input the amount of vegetation species (N): ";
    cin >> N;
    cout << "Input the sample amount (S-even number): ";
    cin >> S;
    if (S % 2 != 0) {
    cout << "Error: sample amount 'S' must be the even number£¡" << endl;
    return 1;
    };

    vector<vector<vector<double>>> a(I, vector<vector<double>>(J, vector<double>(K)));
    vector<vector<vector<double>>> b(I, vector<vector<double>>(J, vector<double>(K)));
    vector<vector<vector<double>>> c(I, vector<vector<double>>(J, vector<double>(K)));
    vector<vector<vector<double>>> d(I, vector<vector<double>>(J, vector<double>(K)));
    vector<vector<vector<int>>> species(I, vector<vector<int>>(J, vector<int>(K)));
    vector<vector<vector<int>>> samplePlot(I, vector<vector<int>>(J, vector<int>(K)));
    
    
    cout << "\n=== Input the individual's abundance ===" << endl;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			cout << "abundance a[" << i << "][" << j << "][" << k << "]: ";
    			cin >> a[i][j][k];
    		}
    	}
    }
    
    cout << "\n=== Input the individual's frequency ===" << endl;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			cout << "frequency b[" << i << "][" << j << "][" << k << "]: ";
    			cin >> b[i][j][k];
    		}
    	}
    }
    
    cout << "\n=== Input the individual's relative size ===" << endl;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			cout << "Relative size c[" << i << "][" << j << "][" << k << "]: ";
    			cin >> c[i][j][k];
    		}
    	}
    }
    
    cout << "\n=== Input the species' identifier number for each individual ===" << endl;
    cout << "Species identifier number: from 0 to " << N - 1 << endl;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			int n;
    			cout << "Species[" << i << "][" << j << "][" << k << "]: ";
    			cin >> n;
    			if (n < 0 || n >= N) {
    				cout << "Error: Species identifier number must be from 0 to" << N - 1 << endl;
    				return 1;
    			}
    			species[i][j][k] = n;
    		}
    	}
    }
    
    cout << "\n=== Input the sample's identifier number for each individual (0-" << S - 1 << ") ===" << endl;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			cout << "Individual(" << i << " " << j << " " << k << ")'s sample identifier: ";
    			cin >> samplePlot[i][j][k];
    			if (samplePlot[i][j][k] < 0 || samplePlot[i][j][k] >= S) {
    				cout << "Error: the sample's identifier number must be from 0 to " << S - 1 << endl;
    				return 1;
    			}
    		}
    	}
    }
    
    // To calculate the relative importance for each individual;
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			d[i][j][k] = (a[i][j][k] + b[i][j][k] + c[i][j][k]) / 3.0;
    		}
    	}
    }
    
    // To calculate the dissimilarity between two samples of each pair;
    double totalDissimilarity = 0.0;
    vector<double> PairDissimilarity (S) ;
    for (int samplePair = 0; samplePair < S; samplePair += 2) {
    
    	// To calculate the dissimilarity for each species;
    	for (int n = 0; n < N; n++) {
    		double sumSample1 = 0.0, sumSample2 = 0.0;
    		int countSample1 = 0, countSample2 = 0;
    
    		for (int i = 0; i < I; i++) {
    			for (int j = 0; j < J; j++) {
    				for (int k = 0; k < K; k++) {
    					if (species[i][j][k] == n && samplePlot[i][j][k] == samplePair) {
    						sumSample1 += d[i][j][k];
    						countSample1++;
    					}
    					if (species[i][j][k] == n && samplePlot[i][j][k] == samplePair + 1) {
    						sumSample2 += d[i][j][k];
    						countSample2++;
    					}
    				}
    			}
    		}
    		// To calculate the dissimilarity for each pair of samples;
    		if (countSample1 > 0  || countSample2 > 0) {
    			double speciesDissimilarity = abs(sumSample1 - sumSample2) / (sumSample1 + sumSample2);
    			totalDissimilarity += speciesDissimilarity;
    			PairDissimilarity[samplePair] = totalDissimilarity;
    		}
    	}
    
    	cout << "Sample" <<" "<< samplePair <<" "<< "and Sample" <<" "<< samplePair + 1 << "'s dissimilarity: " << PairDissimilarity[samplePair] << endl;
    }
    
    // To calculate the sum of importance for the individuals in each sample;
    vector<double> sum_importance(S, 0.0);
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			int currentSample = samplePlot[i][j][k];
    			sum_importance[currentSample] += d[i][j][k];
    		}
    	}
    }
    
    // To input the dominant species' correlation between two samples of a pair;
    vector<double> correlation(S);
    cout << "\n To input the dominant species' correlation between two samples of a pair:" << endl;
    for (int samplePair = 0; samplePair < S; samplePair += 2) {
    	int sample1 = samplePair;
    	int sample2 = samplePair + 1;
    	cout << "Sample" <<" "<< sample1 <<" "<< "and Sample" <<" "<< sample2 << "'s correlation: ";
    	cin >> correlation[samplePair];
    }
    
    vector<double> Genetic_Distance(S);
    cout << "\n To input the dominant species' genetic distance between two samples of a pair:" << endl;
    for (int samplePair = 0; samplePair < S; samplePair += 2) {
    	int sample1 = samplePair;
    	int sample2 = samplePair + 1;
    	cout << "Sample" <<" "<< sample1 <<" "<< "and Sample" <<" "<< sample2 << "'s Genetic Distance: ";
    	cin >> Genetic_Distance[samplePair];
    }
    
    // To output the sum importance for each sample;
    cout << fixed << setprecision(2);
    cout << "\n=== Each sample's sum importance ===" << endl;
    for (int s = 0; s < S; s++) {
    	cout << "Sample " <<" "<< s << " 's sum importance: " << sum_importance[s] << endl;
    }
    
    // To analyze the succession relationship;
    cout << "\n=== To analyze the succession relationship ===" << endl;
    for (int samplePair = 0; samplePair < S; samplePair += 2) {
    	int sample1 = samplePair;
    	int sample2 = samplePair + 1;
    	double corr = correlation[samplePair];
    	double sum1 = sum_importance[sample1];
    	double sum2 = sum_importance[sample2];
    	double PairD = PairDissimilarity[samplePair];
    
    	if (PairD > D) {
    		if (corr < -E) {
    			if (sum1 > sum2) {
    				cout << "Sample" <<" "<< sample1 <<" "<< "invade Sample" <<" "<< sample2 << endl;
    			} else if (sum2 > sum1) {
    				cout << "Sample" <<" "<< sample2 <<" "<< "invade Sample" <<" "<< sample1 << endl;
    			} else {
    				cout << "Sample" <<" "<< sample1 <<" "<< "and Sample" <<" "<< sample2 << " " <<"Stay in Stable state" << endl;
    			}
    		} else {
    			cout << "Sample" <<" "<< sample1 <<" "<< "and Sample" <<" "<< sample2 << " " <<"Stay in Stable state" << endl;
    		}
    	} else {
    			cout << "Sample" <<" "<< sample1 <<" "<< "and Sample" <<" "<< sample2 << " " <<"Stay in Stable state" << endl;
    	}
    
    }
    
    // To analyze the evolution of genetic variation: »
    cout << "\n=== To analyze the evolution of genetic variation ===" << endl;
    for (int samplePair = 0; samplePair < S; samplePair += 2) {
    	int sample1 = samplePair;
    	int sample2 = samplePair + 1;
    	double Genetics = Genetic_Distance[samplePair];
    	double sum1 = sum_importance[sample1];
    	double sum2 = sum_importance[sample2];
    
    	if (Genetics > F) {
    
    		if (sum1 > sum2) {
    			cout << "Sample" <<" "<< sample1 <<" "<< "invade Sample" <<" "<< sample2 << endl;
    		} else if (sum2 > sum1) {
    			cout << "Sample" <<" "<< sample2 <<" "<< "invade Sample" <<" "<< sample1 << endl;
    		} else {
    		    cout << "Sample" <<" "<< sample1 <<" "<<"and Sample" <<" "<< sample2 << " " <<"Stay in Stable state" << endl;
    		}
    	} else {
    		cout << "Sample" <<" "<< sample1 <<" "<<"and Sample" <<" "<< sample2 << " " <<"Stay in Stable state" << endl;
    	}
    }
    
    cout << "\n=== To output the sum of relative importance for each species ===" << endl;
    map<int, vector<tuple<int, int, int, double>>> speciesData;
    
    for (int i = 0; i < I; i++) {
    	for (int j = 0; j < J; j++) {
    		for (int k = 0; k < K; k++) {
    			int n = species[i][j][k];
    			speciesData[n].push_back(make_tuple(i, j, k, d[i][j][k]));
    		}
    	}
    }
    
    cout << fixed << setprecision(4);
    for (int n = 0; n < N; n++) {
    	if (speciesData.find(n) != speciesData.end()) {
    		cout << "\n Species " << n << " 's relative importance£¨Totally " << speciesData[n].size() << " individuals£©:" << endl;
    		cout << "Individual (i,j,k)    ->    relative importance" << endl;
    		cout << "--------------------------------" << endl;
    
    		for (const auto& data : speciesData[n]) {
    			int i = get<0>(data);
    			int j = get<1>(data);
    			int k = get<2>(data);
    			double value = get<3>(data);
    			cout << "(" << setw(2) << i << "," << setw(2) << j << "," << setw(2) << k << ") -> " << setw(10) << value << endl;
    		}
    	} else {
    		cout << "\n Species " << n << " does not occur " << endl;
    	}
    }
    
    cout << "\n=== Species distribution statistics ===" << endl;
    for (int n = 0; n < N; n++) {
    	if (speciesData.find(n) != speciesData.end()) {
    		int count = speciesData[n].size();
    		double percentage = (count * 100.0) / (I * J * K);
    		cout << "Species " << n << ": " << count << " 's position (" << percentage << "%)" << endl;
    	}
    }
    
    return 0;
    

    }

    Downloads
  • V1.3 6be38cd51b

    hliu092 released this 2026-11-24 07:07:20 +00:00 | 0 commits to main since this release

    The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/03

    Introduction: This model adopts the the conception of Reynolds number to simulate the boundary layer formation process, and the multi-dimension arrays are used to calculate the variables in the spatial grids along x, y, z axes;

    Development Language: C++;

    All Rights Reserved.

    Reference: Liu Huan (2024). Exploring the formation of ocean current and the underlying hydrology. Journal of Astronomy and Earth Sciences (ISSN2958-4043). 2024 (12). https://doi.org/10.58473/JAES0011

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID (4e0a2b83688ef1b73a7bada93f0032a4b8eeacd9053a55a08b7fb2f84d215b5e). Registered Time:  2025-11-12 15:33.

    Source Code:
    //@All Rights Reserved by Liu Huan. Source from: https://doi.org/10.58473/JAES0011

    #include<iostream>
    #include <vector>
    #include<math.h>
    #include <map>
    #include <iomanip>
    #include <tuple>

    using namespace std;

    int main ()
    {
    int I,J,K;
    cout << "Input the longitude grid scale (I): ";
    cin >> I;
    cout << "Input the latitude grid scale (J): ";
    cin >> J;
    cout << "Input the altitude grid scale (K): ";
    cin >> K;

    float n=2.0,e=2.718;
    	vector<vector<vector<float>>> X(I, vector<vector<float>>(J, vector<float>(K)));
    	vector<vector<vector<float>>> Y(I, vector<vector<float>>(J, vector<float>(K)));
    	vector<vector<vector<float>>> Z(I, vector<vector<float>>(J, vector<float>(K)));
    	vector<vector<vector<float>>> R(I, vector<vector<float>>(J, vector<float>(K)));
    
    	cout << "\n=== Input the relative speed in each grid ===" << endl;
    	for (int i = 0; i < I; i++) {
    		for (int j = 0; j < J; j++) {
    			for (int k = 0; k < K; k++) {
    				cout << "The relative speed X[" << i << "][" << j << "][" << k << "]: ";
    				cin >> X[i][j][k];
    			}
    		}
    	}
    
    	cout << "\n=== Input the salinity variation in each grid ===" << endl;
    		for (int i = 0; i < I; i++) {
    			for (int j = 0; j < J; j++) {
    				for (int k = 0; k < K; k++) {
    					cout << "The salinity variation Y[" << i << "][" << j << "][" << k << "]: ";
    					cin >> Y[i][j][k];
    				}
    			}
    		}
    
    	cout << "\n=== Input the temperature variation in each grid ===" << endl;
    		for (int i = 0; i < I; i++) {
    			for (int j = 0; j < J; j++) {
    				for (int k = 0; k < K; k++) {
    					cout << "The temperature variation Z[" << i << "][" << j << "][" << k << "]: ";
    					cin >> Z[i][j][k];
    				}
    			}
    		}    
    	
    	for(int i=0;i<I;i++)
    	{
    		for(int j=0;j<J;j++)
    		{
    			for(int k=0;k<K;k++)
    			{
    				R[i][j][k]=2*(pow(X[i][j][k],n))*(pow(e,X[i][j][k]))/(3*((Y[i][j][k])*(Z[i][j][k])));
    			}
    		}
    		
    	}
    	
    	cout << "\n=== The results of Reynolds number ===" << endl;
    		for(int i=0;i<I;i++)
    		{
    			for(int j=0;j<J;j++)
    			{
    				for(int k=0;k<K;k++)
    				{
    				   cout << "Element at R["<< i<< "]["<<j<<"]["<<k<<"]=" << R[i][j][k] << endl;
    				}
    			}
    			
    		}
    			
    	return 0;
    

    }

    Downloads
  • V1.2 6be38cd51b

    hliu092 released this 2026-11-24 07:05:07 +00:00 | 0 commits to main since this release

    The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/02

    Introduction:  My newly designed 3 - dimension (I × E × N) matrix better meets the needs of systematic metabolomics study. This article adopts both 2-dimensional arrays and 3-dimensional arrays to calculate the isozyme zymograms designed in my article, which facilitates the matrix calculation process.

    Development language: C++;

    All Rights Reserved.

    Reference: Liu Huan (2024). Original Review of Environmental Physiology: Photosynthesis and Systematic Metabolomics. Journal of Biological Sciences (ISSN 2958-4035).2024(07). https://doi.org/10.58473/JBS0024

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID. (a397acb64a636cfcefc9ee780a8d5bc8be27ca39a25750e5ae529143e6cbfbb1). Registered Time: 2025-11-13 08:37.

    Source Code:
    //@ All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JBS0024

    #include <bits/stdc++.h>
    using namespace std;
    int a[101][101][101], a1[101][101], a2[101][101], a3[101][101], b1[101][101], b2[101][101], b3[101][101], c1[101][101], c2[101][101], c3[101][101], d1[101][101], d2[101][101], d3[101][101], E1[101][101], E2[101][101], E3[101][101], F1[101][101], G1[101][101], H1[101][101], I1[101][101], I2[101][101], I3[101][101];
    int main ()
    {
    int n,e,i,t;

    cout << "\n=== Input the values (0 or 1) for matrix X[n][e][i] (leaving a space between values) ===" << endl;	
    for(n=1;n<=3;n++)
       for(e=1;e<=4;e++)
          for(i=1;i<=5;i++)
       cin>>a[n][e][i];  //input the value of matrix Xnei£¬ a[n][e][i] is zero or one ; 3*4*5 Matrix
       
       cout<<endl;
    
    for(n=1;n<=3;n++)
    	 for(i=1;i<=5;i++)
    		 b1[n][i]=a[n][1][i];  //select the value of matrix Xni, when e is 1 ; 3*5 Matrix
    
    for(n=1;n<=5;n++)
        for(i=1;i<=3;i++)
             b2[n][i]=b1[i][n];  // the tronspose of matrix Xni ; 5*3 Matrix
             
    for(n=1;n<=5;n++)
    	for(i=1;i<=5;i++) 
    	   for(t=1;t<=3;t++)        
             b3[n][i]+=b2[n][t]*b1[t][i];  // the value of the transpose of matrix Xni (5*3) multiplied by matrix Xni (3*5); final value are 5*5 Matrix
             
    for(n=1;n<=3;n++)
    	 for(i=1;i<=5;i++)
    		 c1[n][i]=a[n][2][i];  //select the value of matrix Xni, when e is 2 ; 3*5 Matrix
    
    for(n=1;n<=5;n++)
        for(i=1;i<=3;i++)
             c2[n][i]=c1[i][n];  //the tronspose of matrix Xni ;  5*3 Matrix
             
    for(n=1;n<=5;n++)
    	for(i=1;i<=5;i++) 
    	   for(t=1;t<=3;t++)        
             c3[n][i]+=c2[n][t]*c1[t][i]; // the value of the transpose of matrix Xni (5*3) multiplied by matrix Xni (3*5); final value are 5*5 Matrix
    		 
    for(n=1;n<=3;n++)
    	 for(i=1;i<=5;i++)
    		 d1[n][i]=a[n][3][i]; //select the value of matrix Xni, when e is 3 ; 3*5 Matrix
    
    for(n=1;n<=5;n++)
        for(i=1;i<=3;i++)
             d2[n][i]=d1[i][n]; //the tronspose of matrix Xni ; 5*3 Matrix
             
    for(n=1;n<=5;n++)
    	for(i=1;i<=5;i++) 
    	   for(t=1;t<=3;t++)        
             d3[n][i]+=d2[n][t]*d1[t][i];	// the value of the transpose of matrix Xni (5*3) multiplied by matrix Xni (3*5); final value are 5*5 Matrix
    		 
    for(n=1;n<=3;n++)
    	 for(i=1;i<=5;i++)
    		 E1[n][i]=a[n][4][i];  //select the value of matrix Xni, when e is 4 ; 3*5 Matrix
    
    for(n=1;n<=5;n++)
        for(i=1;i<=3;i++)
             E2[n][i]=E1[i][n];  //the tronspose of matrix Xni ; 5*3 Matrix
             
    for(n=1;n<=5;n++)
    	for(i=1;i<=5;i++) 
    	   for(t=1;t<=3;t++)        
             E3[n][i]+=E2[n][t]*E1[t][i];	// the value of the transpose of matrix Xni (5*3) multiplied by matrix Xni (3*5); final value are 5*5 Matrix   
    
    cout << "\n=== The matrix (5*5) for variable i ===" << endl;		 
    for(n=1;n<=5;n++)
    {
    	 for(i=1;i<=5;i++)
    	 cout<<b3[n][i]+c3[n][i]+d3[n][i]+E3[n][i]<<" ";  //output the value of the sum of matrix for PCA ; 5*5 Matrix;
    	 cout<<endl;
    }
      
         cout<<endl;
         
    for(n=1;n<=3;n++)
    	for(i=1;i<=5;i++)
    	 a1[n][i]=b1[n][i]+c1[n][i]+d1[n][i]+E1[n][i]; //to calculate the value of Matrix sum Xni ; 3*5 Matrix
    	 
    for(n=1;n<=5;n++)
        for(i=1;i<=3;i++)
             a2[n][i]=a1[i][n]; 	 // the transpose of Matrix sum Xni ; 5*3 Matrix
             
    for(n=1;n<=3;n++)
    	for(i=1;i<=3;i++) 
    	   for(t=1;t<=5;t++)        
             a3[n][i]+=a1[n][t]*a2[t][i];         //the value of Matrix sum Xni (3*5) multiplied by its transpose (5*3); final values are 3*3 Matrix
    
    cout << "\n=== The matrix (3*3) for variable n ===" << endl;	
    for(n=1;n<=3;n++)
    {
    	 for(i=1;i<=3;i++)
    	 cout<<a3[n][i]<<" ";  //output the value for PCA ; 3*3 Matrix; 
    	 cout<<endl;
    }       
    
        cout<<endl;
        
        
    	  return 0;
       }
    

    //@ All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JBS0024

    #include <bits/stdc++.h>
    using namespace std;
    int a1[101][101], a2[101][101], a3[101][101], b1[101][101], b2[101][101], b3[101][101];
    int main ()
    {
    int e,i,t;

    cout << "\n=== Input the values (0 or 1) for matrix X[1][e][i] (leaving a space between values) ===" << endl;		
       for(e=1;e<=4;e++)
          for(i=1;i<=5;i++)
           cin>>a1[e][i];  //input the value of matrix Xei£¬ a1[e][i] is zero or one ; 4*5 Matrix
           
    cout << "\n=== Input the values (0 or 1) for matrix X[2][e][i] (leaving a space between values) ===" << endl;	   
       for(e=1;e<=4;e++)
          for(i=1;i<=5;i++)
          cin>>a2[e][i]; //input the value of matrix Xei£¬ a2[e][i] is zero or one ; 4*5 Matrix
          
    cout << "\n=== Input the values (0 or 1) for matrix X[3][e][i] (leaving a space between values) ===" << endl;	   
        for(e=1;e<=4;e++)
          for(i=1;i<=5;i++)
          cin>>a3[e][i]; //input the value of matrix Xei£¬ a3[e][i] is zero or one ; 4*5 Matrix
          
        cout<<endl;		
    	
    for(e=1;e<=4;e++)
        for(i=1;i<=5;i++)	 
    	b1[e][i]=a1[e][i]+a2[e][i]+a3[e][i]; // the sum of Matrix Xei; 4*5 Matrix	    
    
    for(e=1;e<=5;e++)
        for(i=1;i<=4;i++) 
        b2[e][i]=b1[i][e];  // the transpose of Matrix sum Xei; 5*4 Matrix
        
    for(e=1;e<=4;e++)
        for(i=1;i<=4;i++)	
    	   for(t=1;t<=5;t++)
        b3[e][i]+=b1[e][t]*b2[t][i]; //the value of the Matrix sum Xei (4*5 Matrix), multiplied by its transpose (5*4 Matrix); final values are 4*4 Matrix	
    
    cout << "\n=== The matrix (4*4) for variable e ===" << endl;
    for(e=1;e<=4;e++)
    {
    	 for(i=1;i<=4;i++)
    	 cout<<b3[e][i]<<" ";  //output the value for PCA ; 4*4 Matrix
    	 cout<<endl;
    }       
    
        return 0;
        
    }
    
    Downloads
  • V1.1 6be38cd51b

    hliu092 released this 2026-11-24 07:02:06 +00:00 | 0 commits to main since this release

    `The DOI of this source code: https://doi.org/10.58473/ChengZhuSci0003/01

    Introduction: This model adopts Chinese Eight Diagrams’ matrix to simulate the interaction relationship between Yin and Yang poles in the universe, which is input by using binary algorithm (To simplify the process, the decimalism is used in the calculation process instead);

    Development language: C++;

    All Rights Reserved.

    Reference: Liu Huan. (2021). Ancient Chinese Eight Diagrams and Application on Chemistry Reaction Rate. Journal of Quantum Physics and Materials Chemistry (ISSN2958-4027) , Latest revised on 26/12/2024.  https://doi.org/10.58473/JQPMC0010.

    Copyrights Certificate Registered by Brock Chain Technology: Brock Chain ID. (b3ad241f75c04ffd50bb51603ee38729d3b30867c7f6c40be0c2f70db407998c) ; Register Time: 2025-11-13 10:40;

    Source Code:
    //@ All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JQPMC0010

    #include <bits/stdc++.h>
    using namespace std;
    int a[101][101],b[101][101],c[101][101],d[101][101],e[101][101],f[101][101],g[101][101],H[101][101],I[101][101],J[101][101],K[101][101],L[101][101],M[101][101],N[101][101],O[101][101],P[101][101],Q[101][101],R[101][101];
    int main ()
    {
    cout << "\n=== Input the values' amount (n) for each array ===" << endl;
    int i,j,n,t;
    cin>>n;
    cout << "\n=== Input the values (0 or 1) for n*8 Yin matrix [i][j] (leaving a space between values) ===" << endl;
    for(i=1;i<=n;i++)
    for(j=1;j<=8;j++)
    cin>>a[i][j]; //input the value in Yin array£¬a[i][j] can be 0 or 1

    cout << "\n=== Input the values (0 or 1) for n*8 Yang matrix [i][j] (leaving a space between values) ===" << endl;	   
    for(i=1;i<=n;i++)
        for(j=1;j<=8;j++)
        cin>>b[i][j];  // input the value in Yang array£¬b[i][j] can be 0 or 1
        
        cout<<endl;
        
    cout << "\n=== In total 8 Matrices (n*n) to show the interaction between Yin and Yang matrix in a cycle===" << endl;
    
    for(i=1;i<=8;i++)
       for(j=1;j<=n;j++) 
       c[i][j]=b[j][i];  // To calculate the inverted Yang matrix
       
    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           {
    	   d[i][j]+=a[i][t]*c[t][j];  // To calculate the Yin Matrix multiplied by the inverted Yang Matrix
        }
            
    for(i=1;i<=n;i++)
       {
       	for(j=1;j<=n;j++) 
         cout<<d[i][j]<<" ";    // Output the matrix of the Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£© 
         cout<<endl;
       }
       cout<<endl;   
       
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) e[i][j]=a[i][8];
       	 else e[i][j]=a[i][j-1];   // The transformed Yin Matrix after it circles to the next grid at the clockwise direction 
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           f[i][j]+=e[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<f[i][j]<<" ";           // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©  
       	cout<<endl;  
    }
       cout<<endl;   
    
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) g[i][j]=e[i][8];
       	 else g[i][j]=e[i][j-1];      // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           H[i][j]+=g[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<H[i][j]<<" ";          //  Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }
       cout<<endl;   
     
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) I[i][j]=g[i][8];
       	 else I[i][j]=g[i][j-1];      // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           J[i][j]+=I[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<J[i][j]<<" ";           // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }
       cout<<endl;   
     
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) K[i][j]=I[i][8];
       	 else K[i][j]=I[i][j-1];      // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           L[i][j]+=K[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<L[i][j]<<" ";          // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }
       cout<<endl;   
    
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) M[i][j]=K[i][8];
       	 else M[i][j]=K[i][j-1];      // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           N[i][j]+=M[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<N[i][j]<<" ";          //  Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }
       cout<<endl;   
    
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) O[i][j]=M[i][8];
       	 else O[i][j]=M[i][j-1];      //  The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           P[i][j]+=O[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<P[i][j]<<" ";          // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }
       cout<<endl;   
    
    for(i=1;i<=n;i++)
    {
       for(j=1;j<=8;j++)
       {
       	 if(j==1) Q[i][j]=O[i][8];
       	 else Q[i][j]=O[i][j-1];      //  The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
       }
    

    }

    for(i=1;i<=n;i++)
       for(j=1;j<=n;j++) 
           for(t=1;t<=8;t++)
           R[i][j]+=Q[i][t]*c[t][j];  // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
    
    for(i=1;i<=n;i++)
    {
    	for(j=1;j<=n;j++)
       	cout<<R[i][j]<<" ";          //  Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
       	cout<<endl;  
    }                               // In total 8 Matrices£¨n*n£© used for the next statistics. 
    
           return 0;
       }`
    
    Downloads