半導体の統計学

https://www.renesas.com/jp/ja/document/grl/semiconductor-reliability-handbook


```

import numpy as np
import matplotlib.pyplot as plt

def failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope):
    """
    Generate a failure rate curve with infant mortality, random failure, and wear-out periods.
    
    :param time: Time array
    :param infant_mortality_rate: Initial failure rate for the infant mortality period
    :param random_failure_rate: Constant failure rate for the random failure period
    :param wear_out_start: Time when the wear-out period starts
    :param wear_out_slope: Slope of the failure rate increase in the wear-out period
    :return: Failure rate array
    """
    failure_rate = np.zeros_like(time)
    
    # Infant mortality period
    infant_mortality_end = 0.1 * max(time)
    failure_rate[time < infant_mortality_end] = infant_mortality_rate / np.sqrt(time[time < infant_mortality_end])
    
    # Random failure period
    failure_rate[(time >= infant_mortality_end) & (time < wear_out_start)] = random_failure_rate
    
    # Wear-out period
    failure_rate[time >= wear_out_start] = random_failure_rate + wear_out_slope * (time[time >= wear_out_start] - wear_out_start)
    
    return failure_rate

# Parameters
duration = 1000  # Total time in hours
sampling_rate = 100  # Number of points
time = np.linspace(1, duration, sampling_rate)  # Time array

# Failure rate parameters
infant_mortality_rate = 0.02  # Initial failure rate
random_failure_rate = 0.005  # Constant failure rate during random failure period
wear_out_start = 700  # Start of the wear-out period
wear_out_slope = 0.0001  # Slope of the failure rate increase in the wear-out period

# Generate failure rate curve
failure_rate = failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope)

# Plot the failure rate curve
plt.figure(figsize=(10, 6))
plt.plot(time, failure_rate, label='Failure Rate')
plt.title('Bathtub Curve: Failure Rate over Time')
plt.xlabel('Time [hours]')
plt.ylabel('Failure Rate')
plt.ylim(0, max(failure_rate) * 1.1)
plt.grid()
plt.legend()
plt.show()


```

```
import numpy as np
import matplotlib.pyplot as plt

def failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope):
    """
    Generate a failure rate curve with infant mortality, random failure, and wear-out periods.
    
    :param time: Time array
    :param infant_mortality_rate: Initial failure rate for the infant mortality period
    :param random_failure_rate: Constant failure rate for the random failure period
    :param wear_out_start: Time when the wear-out period starts
    :param wear_out_slope: Slope of the failure rate increase in the wear-out period
    :return: Failure rate array
    """
    failure_rate = np.zeros_like(time)
    
    # Infant mortality period
    infant_mortality_end = 0.1 * max(time)
    failure_rate[time < infant_mortality_end] = infant_mortality_rate / np.sqrt(time[time < infant_mortality_end])
    
    # Random failure period
    failure_rate[(time >= infant_mortality_end) & (time < wear_out_start)] = random_failure_rate
    
    # Wear-out period
    failure_rate[time >= wear_out_start] = random_failure_rate + wear_out_slope * (time[time >= wear_out_start] - wear_out_start)
    
    return failure_rate

def reliability_function(failure_rate, time):
    """
    Calculate the reliability function R(t) from the failure rate.
    
    :param failure_rate: Array of failure rates
    :param time: Array of time values
    :return: Reliability function R(t)
    """
    cumulative_hazard = np.cumsum(failure_rate) * (time[1] - time[0])
    return np.exp(-cumulative_hazard)

def unreliability_function(reliability):
    """
    Calculate the unreliability function F(t) from the reliability function.
    
    :param reliability: Array of reliability values
    :return: Unreliability function F(t)
    """
    return 1 - reliability

# Parameters
duration = 1000  # Total time in hours
sampling_rate = 1000  # Number of points
time = np.linspace(1, duration, sampling_rate)  # Time array

# Failure rate parameters
infant_mortality_rate = 0.02  # Initial failure rate
random_failure_rate = 0.005  # Constant failure rate during random failure period
wear_out_start = 700  # Start of the wear-out period
wear_out_slope = 0.0001  # Slope of the failure rate increase in the wear-out period

# Generate failure rate curve
failure_rate = failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope)

# Calculate reliability and unreliability functions
reliability = reliability_function(failure_rate, time)
unreliability = unreliability_function(reliability)

# Plot the failure rate, reliability function, and unreliability function
plt.figure(figsize=(12, 8))

plt.subplot(3, 1, 1)
plt.plot(time, failure_rate, label='Failure Rate')
plt.title('Failure Rate Curve')
plt.xlabel('Time [hours]')
plt.ylabel('Failure Rate')
plt.grid()
plt.legend()

plt.subplot(3, 1, 2)
plt.plot(time, reliability, label='Reliability Function R(t)', color='green')
plt.title('Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

plt.subplot(3, 1, 3)
plt.plot(time, unreliability, label='Unreliability Function F(t)', color='red')
plt.title('Unreliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Unreliability')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()



```





```

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import cumtrapz

def failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope):
    failure_rate = np.zeros_like(time)
    
    infant_mortality_end = 0.1 * max(time)
    failure_rate[time < infant_mortality_end] = infant_mortality_rate / np.sqrt(time[time < infant_mortality_end])
    
    failure_rate[(time >= infant_mortality_end) & (time < wear_out_start)] = random_failure_rate
    
    failure_rate[time >= wear_out_start] = random_failure_rate + wear_out_slope * (time[time >= wear_out_start] - wear_out_start)
    
    return failure_rate

def reliability_function(failure_rate, time):
    cumulative_hazard = cumtrapz(failure_rate, time, initial=0)
    return np.exp(-cumulative_hazard)

def unreliability_function(reliability):
    return 1 - reliability

def pdf_from_reliability(reliability, time):
    return -np.gradient(reliability, time)

def cumulative_hazard_function(failure_rate, time):
    return cumtrapz(failure_rate, time, initial=0)

# Parameters
duration = 1000  # Total time in hours
sampling_rate = 1000  # Number of points
time = np.linspace(1, duration, sampling_rate)  # Time array

# Failure rate parameters
infant_mortality_rate = 0.02  # Initial failure rate
random_failure_rate = 0.005  # Constant failure rate during random failure period
wear_out_start = 700  # Start of the wear-out period
wear_out_slope = 0.0001  # Slope of the failure rate increase in the wear-out period

# Generate failure rate curve
failure_rate = failure_rate_curve(time, infant_mortality_rate, random_failure_rate, wear_out_start, wear_out_slope)

# Calculate reliability, unreliability, PDF, and cumulative hazard functions
reliability = reliability_function(failure_rate, time)
unreliability = unreliability_function(reliability)
pdf = pdf_from_reliability(reliability, time)
cumulative_hazard = cumulative_hazard_function(failure_rate, time)

# Plotting
plt.figure(figsize=(12, 12))

plt.subplot(3, 2, 1)
plt.plot(time, failure_rate, label='Failure Rate')
plt.title('Failure Rate Function')
plt.xlabel('Time [hours]')
plt.ylabel('Failure Rate')
plt.grid()
plt.legend()

plt.subplot(3, 2, 2)
plt.plot(time, reliability, label='Reliability Function R(t)', color='green')
plt.title('Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

plt.subplot(3, 2, 3)
plt.plot(time, unreliability, label='Unreliability Function F(t)', color='red')
plt.title('Unreliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Unreliability')
plt.grid()
plt.legend()

plt.subplot(3, 2, 4)
plt.plot(time, pdf, label='PDF', color='purple')
plt.title('Probability Density Function (PDF)')
plt.xlabel('Time [hours]')
plt.ylabel('Probability Density')
plt.grid()
plt.legend()

plt.subplot(3, 2, 5)
plt.plot(time, cumulative_hazard, label='Cumulative Hazard Function', color='orange')
plt.title('Cumulative Hazard Function')
plt.xlabel('Time [hours]')
plt.ylabel('Cumulative Hazard')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()


```





```

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import expon

def exponential_failure_rate(mean_lifetime, time):
    return np.full_like(time, 1/mean_lifetime)

def reliability_function_exponential(failure_rate, time):
    return np.exp(-failure_rate * time)

def unreliability_function_exponential(reliability):
    return 1 - reliability

def pdf_exponential(failure_rate, time):
    return failure_rate * np.exp(-failure_rate * time)

def cumulative_hazard_function_exponential(failure_rate, time):
    return failure_rate * time

# Parameters
mean_lifetime = 200  # Mean time to failure (MTTF) in hours
duration = 1000  # Total time in hours
sampling_rate = 1000  # Number of points
time = np.linspace(0, duration, sampling_rate)  # Time array

# Generate exponential failure rate
failure_rate = exponential_failure_rate(mean_lifetime, time)

# Calculate reliability, unreliability, PDF, and cumulative hazard functions for exponential distribution
reliability = reliability_function_exponential(1/mean_lifetime, time)
unreliability = unreliability_function_exponential(reliability)
pdf = pdf_exponential(1/mean_lifetime, time)
cumulative_hazard = cumulative_hazard_function_exponential(1/mean_lifetime, time)

# Plotting
plt.figure(figsize=(12, 12))

plt.subplot(3, 2, 1)
plt.plot(time, failure_rate, label='Failure Rate')
plt.title('Failure Rate Function')
plt.xlabel('Time [hours]')
plt.ylabel('Failure Rate')
plt.grid()
plt.legend()

plt.subplot(3, 2, 2)
plt.plot(time, reliability, label='Reliability Function R(t)', color='green')
plt.title('Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

plt.subplot(3, 2, 3)
plt.plot(time, unreliability, label='Unreliability Function F(t)', color='red')
plt.title('Unreliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Unreliability')
plt.grid()
plt.legend()

plt.subplot(3, 2, 4)
plt.plot(time, pdf, label='PDF', color='purple')
plt.title('Probability Density Function (PDF)')
plt.xlabel('Time [hours]')
plt.ylabel('Probability Density')
plt.grid()
plt.legend()

plt.subplot(3, 2, 5)
plt.plot(time, cumulative_hazard, label='Cumulative Hazard Function', color='orange')
plt.title('Cumulative Hazard Function')
plt.xlabel('Time [hours]')
plt.ylabel('Cumulative Hazard')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()


```

```


import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, lognorm, weibull_min

# Parameters for distributions
mean_lifetime = 200  # Mean lifetime for normal distribution
std_dev = 50  # Standard deviation for normal distribution

shape_param = 1.5  # Shape parameter for Weibull distribution
scale_param = 200  # Scale parameter for Weibull distribution

mu = np.log(mean_lifetime)  # Mu for log-normal distribution (natural log of mean)
sigma = 0.3  # Sigma for log-normal distribution

duration = 500  # Total time in hours
sampling_rate = 1000  # Number of points
time = np.linspace(1, duration, sampling_rate)  # Time array

# Normal Distribution
pdf_normal = norm.pdf(time, mean_lifetime, std_dev)
cdf_normal = norm.cdf(time, mean_lifetime, std_dev)
reliability_normal = 1 - cdf_normal

# Log-Normal Distribution
pdf_lognormal = lognorm.pdf(time, sigma, scale=np.exp(mu))
cdf_lognormal = lognorm.cdf(time, sigma, scale=np.exp(mu))
reliability_lognormal = 1 - cdf_lognormal

# Weibull Distribution
pdf_weibull = weibull_min.pdf(time, shape_param, scale=scale_param)
cdf_weibull = weibull_min.cdf(time, shape_param, scale=scale_param)
reliability_weibull = 1 - cdf_weibull

# Plotting
plt.figure(figsize=(18, 12))

# Normal Distribution
plt.subplot(3, 2, 1)
plt.plot(time, pdf_normal, label='Normal PDF', color='blue')
plt.title('Normal Distribution - PDF')
plt.xlabel('Time [hours]')
plt.ylabel('Probability Density')
plt.grid()
plt.legend()

plt.subplot(3, 2, 2)
plt.plot(time, reliability_normal, label='Normal Reliability Function R(t)', color='green')
plt.title('Normal Distribution - Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

# Log-Normal Distribution
plt.subplot(3, 2, 3)
plt.plot(time, pdf_lognormal, label='Log-Normal PDF', color='blue')
plt.title('Log-Normal Distribution - PDF')
plt.xlabel('Time [hours]')
plt.ylabel('Probability Density')
plt.grid()
plt.legend()

plt.subplot(3, 2, 4)
plt.plot(time, reliability_lognormal, label='Log-Normal Reliability Function R(t)', color='green')
plt.title('Log-Normal Distribution - Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

# Weibull Distribution
plt.subplot(3, 2, 5)
plt.plot(time, pdf_weibull, label='Weibull PDF', color='blue')
plt.title('Weibull Distribution - PDF')
plt.xlabel('Time [hours]')
plt.ylabel('Probability Density')
plt.grid()
plt.legend()

plt.subplot(3, 2, 6)
plt.plot(time, reliability_weibull, label='Weibull Reliability Function R(t)', color='green')
plt.title('Weibull Distribution - Reliability Function')
plt.xlabel('Time [hours]')
plt.ylabel('Reliability')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()

```



```
import numpy as np
import matplotlib.pyplot as plt

# Constants
k = 8.617333262145e-5  # Boltzmann constant in eV/K
Ea = 0.7  # Activation energy in eV (example value)
A = 1e6  # Pre-exponential factor (example value)
T_base = 298  # Base temperature in Kelvin (25°C)

# Temperature range for analysis
temperature = np.linspace(250, 400, 150)  # Temperature range in Kelvin

# Arrhenius equation
def arrhenius_rate(T, A, Ea, k):
    return A * np.exp(-Ea / (k * T))

# Eyring model (including stress)
def eyring_rate(T, S, A, Ea, k, n):
    return A * np.exp(-Ea / (k * T)) * S**n

# Compute failure rates
failure_rate_arrhenius = arrhenius_rate(temperature, A, Ea, k)

# Parameters for the Eyring model
stress = 1.2  # Example stress value
n = 1  # Example constant for stress dependence
failure_rate_eyring = eyring_rate(temperature, stress, A, Ea, k, n)

# Plotting
plt.figure(figsize=(12, 6))

plt.subplot(1, 2, 1)
plt.plot(temperature, failure_rate_arrhenius, label='Arrhenius Model')
plt.title('Failure Rate vs. Temperature (Arrhenius Model)')
plt.xlabel('Temperature [K]')
plt.ylabel('Failure Rate')
plt.grid()
plt.legend()

plt.subplot(1, 2, 2)
plt.plot(temperature, failure_rate_eyring, label='Eyring Model')
plt.title('Failure Rate vs. Temperature (Eyring Model)')
plt.xlabel('Temperature [K]')
plt.ylabel('Failure Rate')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()



```




```

import numpy as np
import matplotlib.pyplot as plt

# Constants for Silicon
K = 0.306  # Thermal conductivity in W/cm·K
rho = 2.33  # Density in g/cm^3
Cp = 0.7566  # Specific heat in J/g·K
Tm = 1688  # Melting temperature in K
Ti = 298  # Initial temperature in K

# Pulse width range (t in seconds)
pulse_width = np.linspace(1e-9, 1e-3, 1000)  # From 1 ns to 1 ms

# Calculate allowable power per unit area
P_per_A = np.pi * K * rho * Cp * (Tm - Ti) * pulse_width**(-0.5)

# Plotting
plt.figure(figsize=(10, 6))
plt.plot(pulse_width, P_per_A)
plt.xscale('log')
plt.yscale('log')
plt.title('Allowable Power per Unit Area vs Pulse Width (Wunsch & Bell Model)')
plt.xlabel('Pulse Width (s)')
plt.ylabel('Allowable Power per Unit Area (W/cm^2)')
plt.grid(True, which='both', linestyle='--', linewidth=0.5)
plt.show()


```




```


import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import poisson

# Parameters
n = 10  # Sample size
c = 2  # Acceptance number
p_values = np.linspace(0, 0.3, 100)  # Fraction defective (p) values from 0 to 0.3

# Function to calculate probability of acceptance using Poisson distribution
def prob_acceptance_poisson(n, c, p):
    pa = np.zeros_like(p)
    for i in range(len(p)):
        pa[i] = np.sum([poisson.pmf(k, n*p[i]) for k in range(c + 1)])
    return pa

# Calculate probability of acceptance for different values of p
P_a = prob_acceptance_poisson(n, c, p_values)

# Plotting the OC curve
plt.figure(figsize=(10, 6))
plt.plot(p_values, P_a, label=f'n={n}, c={c}')
plt.xlabel('Fraction Defective (p)')
plt.ylabel('Probability of Acceptance (P_a)')
plt.title('OC Curve for Acceptance Sampling Plan')
plt.grid(True)
plt.legend()
plt.show()

```



```

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import chi2

# Parameters
n = 10  # Number of units tested
beta = 0.1  # Producer's risk
lambda_failure = 0.001  # Failure rate
c = 0  # Acceptance number (no failures allowed)

# Chi-square value for given beta and degrees of freedom
chi_square_value = chi2.ppf(1 - beta, 2 * (c + 1))

# Calculate required test time T
T = chi_square_value / (2 * lambda_failure * n)
print(f"Required test time T: {T:.2f} hours")

# Total test time for range of λ values
lambda_values = np.linspace(0.0001, 0.002, 500)
test_times = chi_square_value / (2 * lambda_values * n)

# Plotting
plt.figure(figsize=(10, 6))
plt.plot(lambda_values, test_times, label=f'n={n}, β={beta}, c={c}')
plt.axvline(x=lambda_failure, color='r', linestyle='--', label=f'λ={lambda_failure}')
plt.xlabel('Failure Rate λ')
plt.ylabel('Required Test Time T (hours)')
plt.title('Required Test Time vs Failure Rate for Acceptance Sampling Plan')
plt.grid(True)
plt.legend()
plt.show()


```




```
import numpy as np
import matplotlib.pyplot as plt

# Parameters
n = 100  # Total number of samples
h = 1  # Time interval between observations
time_intervals = np.arange(0, 11, h)  # Observation times from 0 to 10
failures = np.array([0, 3, 7, 12, 18, 25, 33, 42, 52, 63, 75])  # Number of failures observed in each interval

# Cumulative number of failures
cumulative_failures = np.cumsum(failures)

# Total observation time
t_total = time_intervals[-1]

# Failure rate (f(t))
failure_rate = failures / (n - np.concatenate(([0], cumulative_failures[:-1])))

# Reliability function (R(t))
reliability = np.exp(-np.cumsum(failure_rate) * h)

# Plotting the discrete failure distribution
plt.figure(figsize=(12, 6))

plt.subplot(1, 2, 1)
plt.bar(time_intervals, failures, width=0.5, align='center', alpha=0.7, color='blue', label='Failures')
plt.xlabel('Time')
plt.ylabel('Number of Failures')
plt.title('Discrete Failure Distribution')
plt.grid(True)
plt.legend()

# Plotting the reliability function
plt.subplot(1, 2, 2)
plt.step(time_intervals, reliability, where='mid', label='Reliability Function (R(t))', color='green')
plt.xlabel('Time')
plt.ylabel('Reliability')
plt.title('Reliability Function')
plt.grid(True)
plt.legend()

plt.tight_layout()
plt.show()



```



```

import numpy as np
import matplotlib.pyplot as plt

# Parameters
lambda_rate = 0.1  # Failure rate parameter (constant for exponential distribution)
time = np.linspace(0, 20, 500)  # Time range from 0 to 20

# Failure rate function λ(t) (constant for exponential distribution)
lambda_t = lambda_rate * np.ones_like(time)

# Reliability function R(t) for exponential distribution
R_t = np.exp(-lambda_rate * time)

# Failure distribution function F(t)
F_t = 1 - R_t

# Plotting
plt.figure(figsize=(12, 6))

# Plot Reliability Function R(t)
plt.subplot(1, 2, 1)
plt.plot(time, R_t, label='Reliability Function R(t)')
plt.xlabel('Time t')
plt.ylabel('Reliability R(t)')
plt.title('Reliability Function R(t)')
plt.grid(True)
plt.legend()

# Plot Failure Distribution Function F(t) and Failure Rate λ(t)
plt.subplot(1, 2, 2)
plt.plot(time, F_t, label='Failure Distribution Function F(t)', color='blue')
plt.xlabel('Time t')
plt.ylabel('Probability')
plt.title('Failure Distribution Function F(t)')
plt.grid(True)
plt.legend()

# Failure Rate λ(t) on the same plot
plt.twinx()  # Create a second y-axis
plt.plot(time, lambda_t, label='Failure Rate λ(t)', color='red', linestyle='--')
plt.ylabel('Failure Rate λ(t)')
plt.legend(loc='upper right')

plt.tight_layout()
plt.show()


```




```

import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gamma

# Parameters
m = 1.5  # Shape parameter
t0 = 1.0  # Scale parameter
eta = t0 * gamma(1 + 1/m)  # Characteristic life
time = np.linspace(0, 3 * eta, 500)  # Time range

# Weibull Failure Distribution Function
F_t = 1 - np.exp(-(time / t0) ** m)

# Mean and Standard Deviation
mu = eta * gamma(1 + 1/m)
sigma = eta * np.sqrt(gamma(1 + 2/m) - gamma(1 + 1/m)**2)
F_mu = 1 - np.exp(-(mu / t0) ** m)

# Plotting the Weibull Failure Distribution Function
plt.figure(figsize=(12, 6))

plt.subplot(1, 2, 1)
plt.plot(time, F_t, label=f'Weibull Failure Distribution Function F(t)')
plt.xlabel('Time t')
plt.ylabel('Failure Probability F(t)')
plt.title('Weibull Failure Distribution Function')
plt.grid(True)
plt.legend()

# Plotting Mean and Standard Deviation
plt.subplot(1, 2, 2)
plt.axvline(x=mu, color='r', linestyle='--', label=f'Mean μ = {mu:.2f}')
plt.axvline(x=mu + sigma, color='g', linestyle='--', label=f'Standard Deviation σ = {sigma:.2f}')
plt.axvline(x=mu - sigma, color='g', linestyle='--')
plt.xlabel('Time t')
plt.ylabel('Failure Probability')
plt.title('Mean and Standard Deviation')
plt.grid(True)
plt.legend()

plt.tight_layout()
plt.show()

# Print values
print(f"Mean μ: {mu:.2f}")
print(f"Standard Deviation σ: {sigma:.2f}")
print(f"Failure Probability at Mean F(μ): {F_mu:.2f}")


```



```

import numpy as np
import matplotlib.pyplot as plt

# Parameters
m = 1.5  # Shape parameter
t0 = 1.0  # Scale parameter
time = np.linspace(0, 3 * t0, 500)  # Time range from 0 to 3*t0

# Cumulative Hazard Function H(t) for Weibull Distribution
H_t = (time / t0) ** m

# Weibull Failure Distribution Function F(t) for comparison
F_t = 1 - np.exp(-H_t)

# Plotting the Cumulative Hazard Function H(t)
plt.figure(figsize=(12, 6))

plt.subplot(1, 2, 1)
plt.plot(time, H_t, label='Cumulative Hazard Function H(t)', color='blue')
plt.xlabel('Time t')
plt.ylabel('Cumulative Hazard H(t)')
plt.title('Weibull Cumulative Hazard Function')
plt.grid(True)
plt.legend()

# Plotting Failure Distribution Function F(t) for comparison
plt.subplot(1, 2, 2)
plt.plot(time, F_t, label='Failure Distribution Function F(t)', color='green')
plt.xlabel('Time t')
plt.ylabel('Failure Probability F(t)')
plt.title('Weibull Failure Distribution Function')
plt.grid(True)
plt.legend()

plt.tight_layout()
plt.show()


```





```
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binom

# Parameters
n = 20  # Number of trials
p = 0.3  # Probability of success
x = np.arange(0, n+1)  # Range of number of successes

# Probability Mass Function for Binomial Distribution
pmf = binom.pmf(x, n, p)

# Mean and Standard Deviation
mean = n * p
std_dev = np.sqrt(n * p * (1 - p))

# Plotting the Binomial Distribution
plt.figure(figsize=(10, 6))

plt.bar(x, pmf, color='skyblue', edgecolor='black', alpha=0.7)
plt.xlabel('Number of Successes (x)')
plt.ylabel('Probability')
plt.title(f'Binomial Distribution PMF\nn={n}, p={p}\nMean = {mean:.2f}, Std Dev = {std_dev:.2f}')
plt.grid(True)
plt.show()

# Print values
print(f"Mean μ: {mean:.2f}")
print(f"Standard Deviation σ: {std_dev:.2f}")



```


```

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import nbinom

# Parameters
r = 5  # Number of failures
p = 0.3  # Probability of failure
x = np.arange(r, 30)  # Range of number of trials

# Probability Mass Function for Negative Binomial Distribution
pmf = nbinom.pmf(x - r, r, p)

# Plotting the Negative Binomial Distribution
plt.figure(figsize=(10, 6))

plt.bar(x, pmf, color='skyblue', edgecolor='black', alpha=0.7)
plt.xlabel('Number of Trials (x)')
plt.ylabel('Probability')
plt.title(f'Negative Binomial Distribution PMF\nFailures = {r}, p = {p}')
plt.grid(True)
plt.show()

# Print values
print(f"Mean: {r / p}")
print(f"Variance: {r * (1 - p) / p**2}")


```








```

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import geom

# Parameters
p = 0.3  # Probability of success
n = np.arange(1, 21)  # Range of trials (1 to 20)

# Probability Mass Function for Geometric Distribution
pmf = geom.pmf(n, p)

# Cumulative Distribution Function for Geometric Distribution
cdf = geom.cdf(n, p)

# Plotting the Geometric Distribution PMF
plt.figure(figsize=(12, 6))

plt.subplot(1, 2, 1)
plt.stem(n, pmf, use_line_collection=True, basefmt=" ", linefmt='b-', markerfmt='bo', label='PMF')
plt.xlabel('Number of Trials (n)')
plt.ylabel('Probability')
plt.title(f'Geometric Distribution PMF\np = {p}')
plt.grid(True)
plt.legend()

# Plotting the Geometric Distribution CDF
plt.subplot(1, 2, 2)
plt.step(n, cdf, where='post', label='CDF', color='green')
plt.xlabel('Number of Trials (n)')
plt.ylabel('Cumulative Probability')
plt.title(f'Geometric Distribution CDF\np = {p}')
plt.grid(True)
plt.legend()

plt.tight_layout()
plt.show()

# Print values
mean = 1 / p
variance = (1 - p) / (p**2)
print(f"Mean μ: {mean:.2f}")
print(f"Variance σ^2: {variance:.2f}")


```







```


import numpy as np
import matplotlib.pyplot as plt

# 発熱密度の計算
def heat_density(power, area):
    return power / area

# LSIチップのパラメータ
lsi_power = 50  # [W]
lsi_length = 1.5  # [cm]
lsi_area = lsi_length * lsi_length  # [cm²]
lsi_heat_density = heat_density(lsi_power, lsi_area)

# ホットプレートのパラメータ
hot_plate_power = 1500  # [W]
hot_plate_diameter = 30  # [cm]
hot_plate_area = np.pi * (hot_plate_diameter / 2) ** 2  # [cm²]
hot_plate_heat_density = heat_density(hot_plate_power, hot_plate_area)

# 欠陥密度の範囲
D = np.linspace(0, 0.1, 100)  # 欠陥密度の範囲 (例: 0から0.1)

# LSIチップの歩留まりの計算
lsi_yield = np.exp(-D * lsi_area)

# 結果の表示
print(f"LSIチップの発熱密度: {lsi_heat_density:.2f} W/cm²")
print(f"ホットプレートの発熱密度: {hot_plate_heat_density:.2f} W/cm²")

# プロット
plt.figure(figsize=(12, 6))

# 発熱密度の比較
plt.subplot(1, 2, 1)
plt.bar(['LSI Chip', 'Hot Plate'], [lsi_heat_density, hot_plate_heat_density], color=['blue', 'red'])
plt.xlabel('Device')
plt.ylabel('Heat Density (W/cm²)')
plt.title('Heat Density Comparison')

# 歩留まりのプロット
plt.subplot(1, 2, 2)
plt.plot(D, lsi_yield, color='green')
plt.xlabel('Defect Density (D)')
plt.ylabel('Yield (Y)')
plt.title('Yield vs. Defect Density')

plt.tight_layout()
plt.show()

```



```
import numpy as np
import matplotlib.pyplot as plt

# パラメータ
L = 1  # チップの長さ (任意単位)
mu = 1  # キャリア移動度 (任意単位)
V_G_Vth = 1  # 元の(VG - Vth) (任意単位)

# スケーリング因子の範囲
k_values = np.linspace(0.1, 10, 100)  # スケーリング因子 (0.1から10)

# 元の時定数
tau_orig = L**2 / (mu * V_G_Vth)

# スケーリング後の時定数
tau_scaled = k_values * tau_orig

# プロット
plt.figure(figsize=(8, 6))
plt.plot(k_values, tau_scaled, label='Scaled Time Constant', color='blue')
plt.xlabel('Scaling Factor (k)')
plt.ylabel('Time Constant')
plt.title('Time Constant vs. Scaling Factor')
plt.grid(True)
plt.legend()
plt.show()




```
```
import numpy as np
import matplotlib.pyplot as plt

# 時間の範囲を設定
time = np.linspace(0, 100, 500)

# 初期不良期（指数関数的に減少）
early_failure_rate = np.exp(-0.1 * time)

# 偶発故障期（一定の故障率）
constant_failure_rate = 0.01 * np.ones_like(time)

# 摩耗故障期（指数関数的に増加）
wear_out_failure_rate = np.exp(0.05 * (time - 50))

# バスタブ曲線を作成
bathtub_curve = early_failure_rate + constant_failure_rate + wear_out_failure_rate

# プロット
plt.figure(figsize=(10, 6))
plt.plot(time, early_failure_rate, label="Early Failures")
plt.plot(time, constant_failure_rate, label="Random Failures")
plt.plot(time, wear_out_failure_rate, label="Wear-out Failures")
plt.plot(time, bathtub_curve, label="Bathtub Curve", linewidth=2, color='black')

plt.title("Bathtub Curve for Electronic Component Reliability")
plt.xlabel("Time")
plt.ylabel("Failure Rate")
plt.yscale("log")
plt.grid(True, which="both", ls="--")
plt.legend()
plt.show()
```

```
import numpy as np

# サンプルデータ（例えば、ウェハの厚さ測定値）
data = np.array([1.01, 0.99, 1.02, 1.00, 1.03, 0.98, 1.01, 1.00, 0.97, 1.02])

# 仕様限界
USL = 1.05  # 上限
LSL = 0.95  # 下限

# 平均と標準偏差
mean = np.mean(data)
std_dev = np.std(data)

# Cpkの計算
cpk = min((USL - mean) / (3 * std_dev), (mean - LSL) / (3 * std_dev))

print(f"プロセス能力指数 (Cpk): {cpk:.2f}")

```


```
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import weibull_min

# ワイブル分布のパラメータ
shape = 2.0  # 形状パラメータ
scale = 1000  # 尺度パラメータ

# 故障時間データの生成
failure_times = weibull_min.rvs(shape, scale=scale, size=1000)

# ワイブル分布のプロット
x = np.linspace(0, 3000, 100)
pdf = weibull_min.pdf(x, shape, scale=scale)

plt.hist(failure_times, bins=30, density=True, alpha=0.6, color='g', label='Failure Data')
plt.plot(x, pdf, 'r-', lw=2, label='Weibull PDF')
plt.xlabel('Time to Failure')
plt.ylabel('Probability Density')
plt.title('Weibull Distribution of Failure Times')
plt.legend()
plt.show()

```

```
import numpy as np
import matplotlib.pyplot as plt

# サンプルデータ（例えば、ロットごとのウェハ厚さの平均値）
data = np.random.normal(loc=1.00, scale=0.01, size=30)

# 平均と標準偏差
mean = np.mean(data)
std_dev = np.std(data)

# 管理限界の設定
UCL = mean + 3 * std_dev / np.sqrt(len(data))
LCL = mean - 3 * std_dev / np.sqrt(len(data))

# プロット
plt.plot(data, marker='o', linestyle='-', color='b')
plt.axhline(y=mean, color='g', linestyle='-', label='Mean')
plt.axhline(y=UCL, color='r', linestyle='--', label='UCL (Upper Control Limit)')
plt.axhline(y=LCL, color='r', linestyle='--', label='LCL (Lower Control Limit)')
plt.title('X̄ Control Chart')
plt.xlabel('Sample')
plt.ylabel('Mean Thickness')
plt.legend()
plt.show()

```




```
import numpy as np
import matplotlib.pyplot as plt

# サンプルデータ（例えば、温度と故障率のデータ）
temperatures = np.array([300, 350, 400, 450, 500])  # 温度 (K)
failure_rates = np.array([0.001, 0.005, 0.02, 0.1, 0.4])  # 故障率

# アレニウスプロットのためのデータ変換
inverse_temps = 1 / temperatures
log_failure_rates = np.log(failure_rates)

# 回帰直線のフィット
coeffs = np.polyfit(inverse_temps, log_failure_rates, 1)
fit_line = np.poly1d(coeffs)

# プロット
plt.scatter(inverse_temps, log_failure_rates, color='blue', label='Data')
plt.plot(inverse_temps, fit_line(inverse_temps), color='red', linestyle='--', label='Fit Line')
plt.title('Arrhenius Plot')
plt.xlabel('1/Temperature (1/K)')
plt.ylabel('Log(Failure Rate)')
plt.legend()
plt.show()

print(f"Fit Line: Log(Failure Rate) = {coeffs[0]:.4f} * (1/T) + {coeffs[1]:.4f}")

```
```
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, classification_report

# サンプルデータ（例えば、製造プロセスのパラメータと故障の有無）
# 特徴量データ
X = np.random.rand(100, 5)
# ラベルデータ（0: 正常, 1: 故障）
y = np.random.randint(0, 2, 100)

# データの分割
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# ランダムフォレストモデルの訓練
clf = RandomForestClassifier(n_estimators=100, random_state=42)
clf.fit(X_train, y_train)

# 予測
y_pred = clf.predict(X_test)

# 結果の評価
accuracy = accuracy_score(y_test, y_pred)
report = classification_report(y_test, y_pred)

print(f"Accuracy: {accuracy:.2f}")
print("Classification Report:\n", report)


```
p25
```
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt

# 信頼度関数と不信頼度関数
def reliability_function(t, lambda_val=1):
    """
    信頼度関数 R(t)
    """
    return np.exp(-lambda_val * t)

def unreliability_function(t, lambda_val=1):
    """
    不信頼度関数 F(t)
    """
    return 1 - reliability_function(t, lambda_val)

# 確率密度関数
def probability_density_function(t, lambda_val=1):
    """
    確率密度関数 f(t)
    """
    return lambda_val * reliability_function(t, lambda_val)

# 故障率関数
def failure_rate_function(t, lambda_val=1):
    """
    故障率関数 λ(t)
    """
    return probability_density_function(t, lambda_val) / reliability_function(t, lambda_val)

# 累積ハザード関数
def cumulative_hazard_function(t, lambda_val=1):
    """
    累積ハザード関数 H(t)
    """
    return lambda_val * t

# 寿命を示す尺度 (MTTF)
def mean_time_to_failure(lambda_val=1):
    """
    MTTF: 平均故障時間を求める
    """
    result, _ = integrate.quad(lambda t: t * probability_density_function(t, lambda_val), 0, np.inf)
    return result

# グラフ表示
t_values = np.linspace(0, 5, 100)
lambda_value = 1

# 各関数の計算
R_values = reliability_function(t_values, lambda_value)
F_values = unreliability_function(t_values, lambda_value)
f_values = probability_density_function(t_values, lambda_value)
lambda_values = failure_rate_function(t_values, lambda_value)
H_values = cumulative_hazard_function(t_values, lambda_value)
MTTF_value = mean_time_to_failure(lambda_value)

# グラフのプロット
plt.figure(figsize=(10, 8))

# 信頼度関数と不信頼度関数のグラフ
plt.subplot(2, 2, 1)
plt.plot(t_values, R_values, label='R(t): Reliability Function')
plt.plot(t_values, F_values, label='F(t): Unreliability Function')
plt.xlabel('Time t')
plt.ylabel('Probability')
plt.legend()
plt.title('Reliability and Unreliability Functions')

# 確率密度関数のグラフ
plt.subplot(2, 2, 2)
plt.plot(t_values, f_values, label='f(t): Probability Density Function')
plt.xlabel('Time t')
plt.ylabel('Density')
plt.legend()
plt.title('Probability Density Function')

# 故障率関数のグラフ
plt.subplot(2, 2, 3)
plt.plot(t_values, lambda_values, label='λ(t): Failure Rate Function')
plt.xlabel('Time t')
plt.ylabel('Failure Rate')
plt.legend()
plt.title('Failure Rate Function')

# 累積ハザード関数のグラフ
plt.subplot(2, 2, 4)
plt.plot(t_values, H_values, label='H(t): Cumulative Hazard Function')
plt.xlabel('Time t')
plt.ylabel('Hazard')
plt.legend()
plt.title('Cumulative Hazard Function')

plt.tight_layout()
plt.show()

# 平均故障時間の表示
print(f"Mean Time To Failure (MTTF): {MTTF_value:.2f}")

```
p29

```
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
from scipy.stats import norm, lognorm

# 定数
lambda_value = 1
mu = 0   # 平均値 (正規分布用)
sigma = 1  # 標準偏差 (正規分布・対数正規分布用)
m = 1.5  # 形状パラメータ (ワイブル分布用)
eta = 2  # 尺度パラメータ (ワイブル分布用)

# 1. 指数分布 (Exponential Distribution)
def exponential_distribution(t, lambda_val=lambda_value):
    f_t = lambda_val * np.exp(-lambda_val * t)
    R_t = np.exp(-lambda_val * t)
    MTTF = 1 / lambda_val
    return f_t, R_t, MTTF

# 2. 正規分布 (Normal Distribution)
def normal_distribution(t, mu=mu, sigma=sigma):
    f_t = (1 / (np.sqrt(2 * np.pi * sigma**2))) * np.exp(-((t - mu)**2) / (2 * sigma**2))
    R_t = 1 - norm.cdf(t, mu, sigma)  # 累積分布関数の補完
    return f_t, R_t

# 3. 対数正規分布 (Log-Normal Distribution)
def log_normal_distribution(t, mu=np.log(mu), sigma=sigma):
    f_t = (1 / (t * sigma * np.sqrt(2 * np.pi))) * np.exp(-((np.log(t) - mu)**2) / (2 * sigma**2))
    R_t = 1 - lognorm.cdf(t, sigma, scale=np.exp(mu))
    return f_t, R_t

# 4. ワイブル分布 (Weibull Distribution)
def weibull_distribution(t, m=m, eta=eta):
    f_t = (m / eta) * (t / eta)**(m - 1) * np.exp(-(t / eta)**m)
    R_t = np.exp(-(t / eta)**m)
    lambda_t = (m / eta) * (t / eta)**(m - 1)
    return f_t, R_t, lambda_t

# グラフ表示のための時間範囲
t_values = np.linspace(0, 10, 500)

# 各分布の計算
f_exp, R_exp, MTTF_exp = exponential_distribution(t_values)
f_norm, R_norm = normal_distribution(t_values)
f_log_norm, R_log_norm = log_normal_distribution(t_values + 1e-5)  # 対数正規分布のt=0回避
f_weibull, R_weibull, lambda_weibull = weibull_distribution(t_values)

# グラフのプロット
plt.figure(figsize=(12, 10))

# 指数分布のグラフ
plt.subplot(2, 2, 1)
plt.plot(t_values, f_exp, label='f(t): Exponential Distribution')
plt.plot(t_values, R_exp, label='R(t): Reliability Function')
plt.xlabel('Time t')
plt.ylabel('Probability / Reliability')
plt.legend()
plt.title('Exponential Distribution')

# 正規分布のグラフ
plt.subplot(2, 2, 2)
plt.plot(t_values, f_norm, label='f(t): Normal Distribution')
plt.plot(t_values, R_norm, label='R(t): Reliability Function')
plt.xlabel('Time t')
plt.ylabel('Probability / Reliability')
plt.legend()
plt.title('Normal Distribution')

# 対数正規分布のグラフ
plt.subplot(2, 2, 3)
plt.plot(t_values, f_log_norm, label='f(t): Log-Normal Distribution')
plt.plot(t_values, R_log_norm, label='R(t): Reliability Function')
plt.xlabel('Time t')
plt.ylabel('Probability / Reliability')
plt.legend()
plt.title('Log-Normal Distribution')

# ワイブル分布のグラフ
plt.subplot(2, 2, 4)
plt.plot(t_values, f_weibull, label='f(t): Weibull Distribution')
plt.plot(t_values, R_weibull, label='R(t): Reliability Function')
plt.plot(t_values, lambda_weibull, label='λ(t): Failure Rate')
plt.xlabel('Time t')
plt.ylabel('Probability / Reliability / Failure Rate')
plt.legend()
plt.title('Weibull Distribution')

plt.tight_layout()
plt.show()

```
p34



```
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt

# 定数
k = 8.617e-5  # ボルツマン定数 (eV/K)
h = 6.626e-34  # プランク定数 (Js)

# モデルパラメータ
Ea = 0.8  # 活性化エネルギー (eV)
A = 1e12  # 定数 (反応速度用)
T1 = 300  # 温度1 (K)
T2 = 350  # 温度2 (K)
S = 5  # ストレス因子
b = 1.5  # アイリングモデル用定数

# 1. 反応速度論モデル
def reaction_rate_model(T, Ea=Ea, k=k, A=A):
    """
    反応速度論モデルの一般式 K = A * exp(-Ea / (k * T))
    """
    return A * np.exp(-Ea / (k * T))

# 2. アレニウスモデル
def arrhenius_model(T, Ea=Ea, k=k):
    """
    アレニウスモデルの一般式 ln(L) = A + Ea / (k * T)
    """
    return A + (Ea / (k * T))

# 3. アイリングモデル
def eyring_model(T, Ea=Ea, k=k, h=h, S=S, b=b):
    """
    アイリングモデルの一般式 K = a(T) * h * exp(-Ea / (k * T)) * S^b
    """
    return h * np.exp(-Ea / (k * T)) * S**b

# 4. ストレス・ストレングスモデル
def stress_strength_model(f_stress, R_strength):
    """
    ストレス・ストレングスモデルの故障確率を求める
    P(failure) = ∫ f(stress) * R(strength) d(stress)
    """
    # 故障確率の計算
    result, _ = integrate.quad(lambda stress: f_stress(stress) * R_strength(stress), -np.inf, np.inf)
    return result

# 例として、正規分布を用いたストレスとストレングスの関数
def normal_distribution_stress_strength(mu, sigma):
    """
    正規分布を用いたストレスとストレングスの関数
    """
    return lambda x: (1 / (sigma * np.sqrt(2 * np.pi))) * np.exp(-((x - mu)**2) / (2 * sigma**2))

# 正規分布パラメータ (ストレスとストレングスの例)
mu_stress = 10  # ストレスの平均
sigma_stress = 2  # ストレスの標準偏差
mu_strength = 15  # ストレングスの平均
sigma_strength = 3  # ストレングスの標準偏差

# ストレスとストレングスの関数を作成
f_stress = normal_distribution_stress_strength(mu_stress, sigma_stress)
R_strength = normal_distribution_stress_strength(mu_strength, sigma_strength)

# 各モデルの計算
reaction_rate_T1 = reaction_rate_model(T1)
reaction_rate_T2 = reaction_rate_model(T2)
arrhenius_T1 = arrhenius_model(T1)
arrhenius_T2 = arrhenius_model(T2)
eyring_T1 = eyring_model(T1)
eyring_T2 = eyring_model(T2)
failure_probability = stress_strength_model(f_stress, R_strength)

# 結果の表示
print(f"反応速度論モデル (T1): K = {reaction_rate_T1:.2e}")
print(f"反応速度論モデル (T2): K = {reaction_rate_T2:.2e}")
print(f"アレニウスモデル (T1): ln(L) = {arrhenius_T1:.2f}")
print(f"アレニウスモデル (T2): ln(L) = {arrhenius_T2:.2f}")
print(f"アイリングモデル (T1): K = {eyring_T1:.2e}")
print(f"アイリングモデル (T2): K = {eyring_T2:.2e}")
print(f"ストレス・ストレングスモデルによる故障確率: P(failure) = {failure_probability:.2e}")

```




P39

```
import numpy as np

# Equation (2-15): Reliability function
def R(t_a, eta, m):
    return np.exp(-(t_a / eta) ** m)

# Equation (2-16): Cumulative distribution function
def F(t, eta, m):
    return 1 - R(t, eta, m)

# Equation (2-17): Ratio of reliability functions
def R_prime(t, t_a, eta, m):
    return np.exp(-((t_a + t) / eta) ** m + (t_a / eta) ** m)

# Calculation of η using the given formula
def calculate_eta(t_a, R_t_a, m):
    return t_a / (-np.log(R_t_a)) ** (1 / m)

# Example values to test the functions
t_a = 1000  # Example value of screening time in hours
R_t_a = 0.9  # Example reliability at screening time t_a
m = 2.5  # Example shape parameter for the Weibull distribution

# Calculate η
eta = calculate_eta(t_a, R_t_a, m)

# Reliability at time t_a
reliability = R(t_a, eta, m)

# Cumulative failure probability at time t_a
failure_prob = F(t_a, eta, m)

# Ratio of reliabilities R'(t)
t = 500  # Example time
reliability_ratio = R_prime(t, t_a, eta, m)

reliability, failure_prob, reliability_ratio, eta

```

P42



```
import numpy as np

# Constants
Ea = 0.80  # Activation energy in eV
k = 8.617e-5  # Boltzmann's constant in eV/K

# Temperatures in Kelvin
T_a = 40 + 273.15  # Actual usage temperature (40°C converted to Kelvin)
T_b = 125 + 273.15  # Accelerated temperature (125°C converted to Kelvin)

# Arrhenius Model for Lifetime
def lifetime(T, Ea, k):
    return np.exp(Ea / (k * T))

# Acceleration Factor
def acceleration_factor(Ea, k, T_a, T_b):
    return np.exp(Ea / k * (1/T_b - 1/T_a))

# Calculate acceleration factor
gamma_r = acceleration_factor(Ea, k, T_a, T_b)

# Calculate lifetime at actual usage temperature
L_Ta = gamma_r * 1000  # Lifetime at Ta (assuming L(Tb) = 1000 hours)

# Failure rate calculation
initial_failure_rate = 5.1e-6  # Initial failure rate at accelerated condition
failure_rate = initial_failure_rate / gamma_r

# Display results
gamma_r, L_Ta, failure_rate

```





P44
```
import numpy as np

# Given parameters
Delta_Ta = 40  # Actual temperature difference (°C)
Delta_Tb = 205  # Accelerated temperature difference (°C)
n = 6  # Exponent parameter for temperature cycling

# Calculate acceleration factor
def acceleration_factor_temp(Delta_Ta, Delta_Tb, n):
    return (Delta_Ta / Delta_Tb) ** (-n)

# Calculate number of cycles at actual condition
def num_cycles_at_actual_condition(cycles_accelerated, acceleration_factor):
    return cycles_accelerated * acceleration_factor

# Failure rate calculation
def failure_rate_calculation(failure_rate_acc, num_cycles_actual, duration, acceleration_factor):
    return (failure_rate_acc * num_cycles_actual * duration) / acceleration_factor

# Calculating acceleration factor
gamma_r_temp = acceleration_factor_temp(Delta_Ta, Delta_Tb, n)

# Number of cycles at accelerated condition (example value)
cycles_accelerated = 200  # Number of cycles at accelerated condition

# Number of cycles at actual condition
num_cycles_actual = num_cycles_at_actual_condition(cycles_accelerated, gamma_r_temp)

# Initial failure rate at accelerated condition (example value)
failure_rate_acc = 0.92  # Failure rate at 60% reliability

# Duration (in hours) for calculation (example value)
duration = 24  # Test duration in hours

# Calculate final failure rate
final_failure_rate = failure_rate_calculation(failure_rate_acc, num_cycles_actual, duration, gamma_r_temp)

# Display results
gamma_r_temp, num_cycles_actual, final_failure_rate

```

p45



```
import numpy as np

# Constants
Ea = 1.0  # Activation energy in eV
k = 8.617e-5  # Boltzmann's constant in eV/K

# Temperatures in Kelvin
T_a = 30 + 273.15  # Actual usage temperature (30°C converted to Kelvin)
T_b = 85 + 273.15  # Accelerated temperature (85°C converted to Kelvin)

# Calculation of Acceleration Factor for Temperature
def temperature_acceleration_factor(Ea, k, T_a, T_b):
    return np.exp(Ea / k * (1/T_b - 1/T_a))

# Calculate acceleration factor
gamma_H = temperature_acceleration_factor(Ea, k, T_a, T_b)

# Example: Initial failure rate at accelerated condition (example value)
initial_failure_rate = 0.92  # Failure rate at 60% reliability

# Test conditions
num_cycles = 1000  # Number of cycles (example value)
duration = 22  # Test duration in hours

# Final Failure Rate Calculation
final_failure_rate = (initial_failure_rate * num_cycles * duration) / gamma_H

# Display results
gamma_H, final_failure_rate

```





```

```

```

```





```

```





```

```