1

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

Nikolas
  • 105
  • 9
  • What is “SigmaFail = xTensionLaminate*VF, 30] ”? – Apple Jun 22 '14 at 16:04
  • Also "FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers" – Apple Jun 22 '14 at 16:06
  • @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] – Nikolas Jun 22 '14 at 16:14
  • 2
    never use goto. Try reworking your code using While – george2079 Jun 22 '14 at 16:20
  • @george2079. Ok, but how do I update σAppliedFibers from the equation for each iteration in the formula -> FibersTensionFail1 = CDF[NormalDistribution[795, 50 ], σAppliedFibers]. The new σAppliedFibers(stress) goes each time through a new CDF to obtain the new FibersTensionFail. ? – Nikolas Jun 22 '14 at 16:24
  • if you are unsure about how to proceed a good approach is to first write a Do loop (fixed number of iterations), then when that works its a simple change to turn it into a While loop. Take a stab and ask for help if you get stuck. – george2079 Jun 22 '14 at 16:40
  • 2
    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 – Dr. belisarius Jun 22 '14 at 17:08
  • σAppliedFibers = σAppliedFibers/(1 - FibersTensionFail) or σAppliedFibers = σApplied/(1 - FibersTensionFail) ? – george2079 Jun 23 '14 at 12:28
  • @george2079 = 'σAppliedFibersNew = σAppliedFibers/(1 - FibersTensionFail1) ' . 'σAppliedFibersNew' is the new stress on the fibers. 'σAppliedFibers/(1 - FibersTensionFail1)'. 'σAppliedFibers' changes after going through the other two equations. I wrote it as new meaning it changed. This is my question. How to keep this variable with the same name but changes after applying the other formulas and then returning again to the CDF – Nikolas Jun 23 '14 at 19:10
  • What's with all these questions about stretching fibers? – Oleksandr R. Jun 24 '14 at 08:17
  • @OleksandrR. These values of "Strechning of Fibers" is used for the standard distribution of the above model. It is a different part of the calculation. – Nikolas Jun 24 '14 at 08:50

2 Answers2

3
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

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
  • Thank you this graph is helpful but it does not show where the converge is of the two variables 'FibersTensionFail and 'FibersTensionRemaining' – Nikolas Jun 22 '14 at 20:03
2
 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 )

george2079
  • 38,913
  • 1
  • 43
  • 110