replace variables in a bunch of systems
Posted: Thu Dec 08, 2016 7:46 am
What I have is a bunch of equation systems, and in order to clean them up and correct a consistent error in all of them I have written the following bit of code:
Basically what it does is replace a bunch of expressions everywhere they occur in the equations, but I can't assign the correct equations to the original eq systems. How should I do that? Should I overwrite the systems completely because I will have to reestimate them anyways?
best regards,
Code: Select all
for %sys {%system_list_3f}
svector equations = {%sys}.@svectornb 'The lines of the system are here
'Create a temporary system for safety reasons
system tempsys
for !x=1 to (@rows(equations))
%equation = equations(!x)
for !y=1 to (@wcount(%eq_3f_or))
'replace the wrong parts of the equations
%equation = @replace(%equation, @word(%eq_3f_or, !y), @word(%eq_3f_re, !y))
next
'append the corrected to tempsys
tempsys.append {%equation}
next
{%sys}.@svectornb = tempsys.@svectornb
nextbest regards,