Re: Logical expressions help! (newbie)
- From: Andreas Koch <nospam@xxxxxxxxxxxxxxx>
- Date: Sun, 25 Jun 2006 19:51:27 +0200
Hi Nektarios,
Suppose you have a mathematical expression valid if 0,5 < x < 2
where x is a real number.
Suppose again that you have a second mathematical expression valid if 0<x<1,5.
Now let the user enter x in a Edit box.
If user enters x=1 the program should inform him that both mathematical expressions works for him and let him choose which mathematical expression works for him.
I think i understand that part.
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 ?
How can i make the program to find out that both mathematical expressions are valid ( "if then else" won't work in case of x=1 ) and inform the user about that ?
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?
.
- Follow-Ups:
- Re: Logical expressions help! (newbie)
- From: Nektarios - Greece
- Re: Logical expressions help! (newbie)
- References:
- Logical expressions help! (newbie)
- From: Nektarios - Greece
- Logical expressions help! (newbie)
- Prev by Date: Re: Logical expressions help! (newbie)
- Next by Date: Re: Logical expressions help! (newbie)
- Previous by thread: Re: Logical expressions help! (newbie)
- Next by thread: Re: Logical expressions help! (newbie)
- Index(es):