1
$\begingroup$

I have the following program which i need to repeat steps until until two variables converge and I want this to be printed with the number of iterations:

What I have :

Input variables:

xTensionLaminate = 1325
SigmaFail = xTensionLaminate*VF
σApplied = xTensionLaminate*0.25
VF = 0.6

then the program is steps:

1.Apply tension part of the cycle. The applied stress on the fibers is

σAppliedFibers = σApplied/VF

2.All fibers with strength less than SigmaAppliedFibers fail. The fraction of fibers that have failed are:[%][7]

FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers]

3.Fraction of fibers that remain[%][8]

FibersTensionRemaining1 = 1 - FibersTensionFail1

4.The remaining fibers now are equally loaded by the new stress[Mpa]

σAppliedFibersNew = σAppliedFibers/(1 - FibersTensionFail1)

5.Repeat steps corresponding to equations [7][8] until either convergence of (FibersTensionFail1 = FibersTensionRemaining1)<1 or all fibers fail FibersTensionFail1=1

This iteration needs to be done until FibersTensionRemaining and FibersTensionFail are equal or either one equal to unity.

So I try to put this in a While loop.

While[FibersTensionRemaining <= FibersTensionFail,
 FibersTensionFail = CDF[NormalDistribution[795, 50 ], σAppliedFibers];
 FibersTensionRemaining = 1 - FibersTensionFail;
 σAppliedFibersNew = σAppliedFibers/(1 - FibersTensionFail)

My question here is that in the NormalDistribution the σAppliedFibers variable changes at each iteration according to the formula σAppliedFibersNew = σAppliedFibers/(1 - FibersTensionFail) so the new σAppliedFibers comes back into FibersTensionFail = CDF[NormalDistribution[795, 50 ], σAppliedFibers]; where after doing this n number of times there should be a converge in FibersTensionRemaining and FibersTensionFail

Please help on this as i cannot find the way

Thanks,

Nick

EDIT: Note: The name of the Variables are slightly changed here but are the same.

What I do as a code manually and I stop the calculation:

1st iteration:

AccountingForm[
FibersFailed1 = 
CDF[NormalDistribution[795, 50  ], StressAppliedFibers1] , 30] = 0.0000005919095091896093
AccountingForm[FibersRemaining1 = 1 - FibersFailed1, 31] = 0.999999408090491
StressAppliedFibers2 = StressAppliedFibers/(1 - FibersFailed1) = 552.084

2nd iteration:

AccountingForm[
FibersFailed2 = 
CDF[NormalDistribution[795, 50  ], StressAppliedFibers2], 30] = 0.000000591909509834259
AccountingForm[FibersRemaining2 = 1 - FibersFailed2, 30]=0.99999940809049
StressAppliedFibers3 = StressAppliedFibers/(1 - FibersFailed2)=552.084

3rd Iteration:

AccountingForm[
FibersFailed3 = 
CDF[NormalDistribution[795, 50 ], StressAppliedFibers3] , 30]=0.0000005919095098342807
AccountingForm[FibersRemaining3 = 1 - FibersFailed3, 30]= 0.99999940809049
StressAppliedFibers4 = StressAppliedFibers/(1 - FibersFailed3)=552.084

4th Iteration:

AccountingForm[
FibersFailed4 = 
CDF[NormalDistribution[795, 50 ], StressAppliedFibers4] , 30]=0.0000005919095098342807
AccountingForm[FibersRemaining4 = 1 - FibersFailed4, 30]= 0.99999940809049
StressAppliedFibers5 = StressAppliedFibers/(1 - FibersFailed4)=552.084

So what we can see here is that after the 3rd iteration the values remain the same no matter how many iterations are made again.

What I need to figure how to make the loop which will take these variables and change them until the values converge and then print the number of iterations and also the final value of The FibersRemaining and StressAppliedFibers. Simple yes but I do not know how to add to a loop changeable variables.

thanks

N

$\endgroup$
  • $\begingroup$ What is “SigmaFail = xTensionLaminate*VF, 30] ”? $\endgroup$ – Apple Jun 22 '14 at 16:04
  • $\begingroup$ Also "FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers" $\endgroup$ – Apple Jun 22 '14 at 16:06
  • $\begingroup$ @Chenminqi it's a typo from copying from my mathematica file. it is: “SigmaFail = xTensionLaminate*VF. ignore the 30]. i will edit it above now. Also FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers is edited above to FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers] $\endgroup$ – Nikolas Jun 22 '14 at 16:14
  • 2
    $\begingroup$ never use goto. Try reworking your code using While $\endgroup$ – george2079 Jun 22 '14 at 16:20
  • 2
    $\begingroup$ p=NestList[{CDF[NormalDistribution[795,50],#[[2]]],#[[2]]/(1-#[[1]])}&,{CDF[NormalDistribution[795,50],\[Sigma]AppliedFibers],\[Sigma]AppliedFibers},10^5];ListPlot[#,MaxPlotPoints->1000]&/@Transpose@p $\endgroup$ – Dr. belisarius Jun 22 '14 at 17:08
3
$\begingroup$
xTensionLaminate = 1325;
sApplied = xTensionLaminate*0.25;
VF = 0.6;
SigmaFail = xTensionLaminate*VF;
sAppliedFibers = sApplied/VF;

p = NestWhileList[{CDF[NormalDistribution[795, 50], #[[2]]], #[[2]]/(1 - #[[1]])} &, 
                  {CDF[NormalDistribution[795, 50], sAppliedFibers], sAppliedFibers}, 
                  #[[1]] < .5 &, 1];

ListLinePlot[Log@p[[All, 1]], PlotRange -> All]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you this graph is helpful but it does not show where the converge is of the two variables 'FibersTensionFail and 'FibersTensionRemaining' $\endgroup$ – Nikolas Jun 22 '14 at 20:03
2
$\begingroup$
 xTensionLaminate = 1325;
 sApplied = xTensionLaminate*0.25;
 VF = 0.6;
 sAppliedFibers = sApplied/VF
 fibersTensionFail = CDF[NormalDistribution[795, 50], sAppliedFibers];
 fibersTensionRemaining = 1 - fibersTensionFail;
 q = First@Last@Reap@
 While[1 - CDF[NormalDistribution[795, 50], sAppliedFibers] > 0,
  fibersTensionFail = CDF[NormalDistribution[795, 50], sAppliedFibers];
  fibersTensionRemaining = 1 - fibersTensionFail;
  sAppliedFibers = sAppliedFibers/(1 - fibersTensionFail);
  Sow[{fibersTensionFail, fibersTensionRemaining}]
  ];

 ListLinePlot[Log@q[[All, 1]], PlotRange -> All]

same as other answer

Now if we plot the quantites you want to converge together:

 GraphicsRow@{ListLinePlot[q[[All, 1]]], ListLinePlot[q[[All, 2]]]}

enter image description here

you see that they never come together before the fiber stress blows up. (They do converge for larger standard deviation however ). Edit -- they would eventually converge if CDF was computed to higher precision. (something is wrong with your algorithm if you need to worry about that though )

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.