[Getdp] ... Multiline Functions ...

mkoch at gvtc.com mkoch at gvtc.com
Mon Feb 26 23:20:05 CET 2007


Hi All,

would one of you know whether GetDP permits multiline functions? For  
example, right now, I am implementing each function on its own line,  
such as follows:

Function {
// --- Minimum Function ------------------------------------------------

   MinFct[] = $1 < $2 ? $1 : $2;

// --- Maximum Function ------------------------------------------------

   MaxFct[] = $1 > $2 ? $1 : $2;

// --- Bracket Function (clamp to between 200 oC and 600 oC) -----------

   BktFct[] = MinFct[MaxFct[$1,200.00],600.0];

// --- Thermal Conductivity Function -----------------------------------

   TheConTbl = {200,10,
                300,20,
                400,30,
                500,40,
                600,50}; // [W/Km]

   TheConFct[$1] = InterpolationLinear[BktFct[$1]]{List[TheConTbl]};
}

However, I would much rather have something like this:

Function {
// --- Thermal Conductivity Function -----------------------------------
   TheConFct[]
    {  TheConTbl = {200,10,
                    300,20,
                    400,30,
                    500,40,
                    600,50};

       Tmp = $1;

       If ($1 < 200.0)
         Tmp = 200.00;
       EndIf

       If ($1 > 600.0)
         Tmp = 600.00;
       EndIf

       TheConFct = LinearInterpolation[Tmp]{List[TheConTbl]};
   }
}

In other words, a more traditional function setup. Can that be done?  
Also, I have experimented with more than one Function{} statement in  
my problem. This does seem to work, but I am not sure if that is  
legal, i.e. does only one of them get recognized?

Thanks,

Matt Koch