Question: Filling an array with a for loop & defining a variable twice within a loop


I am having some trouble with a recursive formula which I instead turned into a loop to avoid any errors. I defined an array before starting the loop and defined the last index as a floating number (this will be the initial point used in the loop). Within the loop, I first defined my recursive formula (which contains other arrays that are indexed; everything is switched to floating points) and it equates without trouble. Underneath this (still within the loop), I defined the variable once more with another function. The loop seems to be equating properly in that order, but when I go to display the array outside of the loop it is empty. I assume this is a problem due to the fact that I defined the same variable as two different functions (which are equated properly in the correct order), so the loop is spitting out two different floating points for each index, and the array doesn`t know which to store. Is there any way to store the last equated value only, so that I can use this array for further calculations?


Here is the portion of my code in question:

Flux_softening_point_V3 := 100.0;
Base_softening_point_V3 := 225.0;
Initial_softening_point := Array(1 .. 289);
Initial_softening_point[289] := Base_softening_point_V3;

for i from b-1 by -1 to a do Initial_softening_point[i] := (evalf(Initial_softening_point[i+1])*(evalf(Mass_V3(i+1))-evalf(V3_flux_charge_rate(i+1))*interval)+evalf(Flux_softening_point_V3(i))*evalf(V3_flux_charge_rate(i))*interval)/evalf(Mass_V3(i));

Initial_softening_point[i]; Initial_softening_point[i] := evalf(Initial_softening_point[i])+(0.1e-3*evalf(Residence_time_V3[i])+0.121e-1)*evalf(V3_oxidation[i])/(12.0) end do;

Please Wait...