'Performing Excel formula in Python
import numpy
K = 1
Rmv = 26
SigS = 111.7
M = 2.050
N = 2
SigD = (-249.4)
def Mittelspannung():
result = []
Y = []
SigM = []
for i in range(1,31):
output = 1 - pow((((i-1)*1/14.5)-1),2)
#Z = Rmv - (output*Rmv)
result.append(output)
#print(output)
for value in range(0,15):
C4 = (Rmv) - (result[value]) * (Rmv)
Y.append(C4)
print(C4)
for value in range(15,30):
B11 = (SigD) - (result[value]) * (SigD)
Y.append(B11)
print(B11)
for x in range(0,30):
SigMean = pow(SigS,M) * pow(1-(pow(Y[x]+SigS,N)/(pow(Rmv+SigS,N))),1/M)
#SigMean = (pow(SigS,M) * pow(1-((Y[x]+SigS)/(Rmv+SigS),N/M))/K
#($C$5^$C$6*(1-($N4+$C$5)^$C$8/($C$4+$C$5)^$C$8))^(1/$C$6)
SigM.append(SigMean)
#print(Y[value])
return SigM
print(Mittelspannung())
From the above script I can execute the output same as excel. But, the last for loop I couldn't get the output same as Excel. I also mentioned the Excel formula in my code.
The output for SigM in Excel is 25.8 but in Python I'm getting 3650.9824739444566.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|