Re: Logical expressions help! (newbie)





>> The mathematical expressions calculate "Nusselt number" , a number to
calculate heat transfer phenomena. The mathematical expressions do NOT find the same Nusselt number. A 10% deviation is present.
Example
Nusselt1=2*x+3
Nusselt2=5*x-1

I think i don't understand that part.
The expressions mentioned above check if a number is in two
ranges. They don't calculate anything. How do you get from
0,5 < x < 2 and 0<x<1,5 to 2*x+3 and 5*x-1 ?



procedure Button1Click(Sender:Tobject);

var
Valid1,Valid2:Boolean;
x:extended;
begin
x:=StrToFloat(Edit1.text);
Valid1:=(0.5<x) and (x<2);
Valid2:=(0<x) and (x<1.5);
If Valid1 and Valid2 then ShowMessage('Both are valid')
else if Valid1 then ShowMessage('Expression 1 is valid)
else ShowMessage('Expression 2 is valid);
end;

After that, the program should present the two results in the same form.

What results? In what form?


If 0.5<x<2 then Nusselt=Nusselt1=2*x+3
If 0<x<1.5 then Nusselt=Nusselt2=5*x-1

The user enters x = 1. So BOTH expressions will work for him. But the program has to inform him, calculate Nusselt1 and Nusselt2 and present in the same form the two results (Nusselt1 and Nusselt2).


.


Quantcast