I have an algebra equation that is used at work and while I can sit down and figure out the result I’m just having a hard time getting my brain to transfer it to xojo code.
The equation is basically Q*R * sqrt(P+14.7 /14.7) * sqrt(530 /T + 460)
(sorry not sure how to enter all the correct symbols to make it easier to read)
So with the numbers I have it would be .17 * 36.02 * sqrt(87 + 14.7 / 14.7) * sqrt(530 / 69 + 460)
I had this in xojo code: qd101_corr_flow_150 = (6.1234 * sqrt(fqd101_pressure_150value * 1 + 14.7 / 14.7) * sqrt(530 / (fqd101_temp_150value * 1) + 460)) but obviously it is not correct
dim q as double =0.17
dim r as double =36.02
dim p as double = 87
dim t as double = 69
dim answer as double
answer=Q*R*sqrt(p+14.7/14.7)*sqrt(530/t+460)
replace q, r, p and t with other variable names if you wish
I think your issue may have to do with precedence … that is when there are no () , which gets calcuated first
sqrt(p+14.7/14.7) might need to be sqrt((p+14.7)/14.7) otherwise it ends up (p+1)
When I do the equation in a calculator I get 16.1057 but in Xojo I’m getting 1242.25 (not saying it’s Xojo as I know it is me)
When I run the equation in my Calc I get 16.1057 but in Xojo using the code:
dim q as double =0.17
dim r as double =36.02
dim p as double = 87
dim t as double = 69
dim answer as double
answer=Q*R*sqrt(p+14.7/14.7)*sqrt(530/t+460)
I get 1242.25 and I did try changing sqrt(p+14.7/14.7) might need to be sqrt((p+14.7)/14.7) but it was off also
gives me 16.12147
which while closer to your 16.1057 than 1242 is, it is still not the “same” answer
but it it the only combination that even comes close…
I’m sure it is me making a mistake and thank you for letting me know your result
Appreciate the help and I will take a break and come back to it after some fresh air[/quote]
are you SURE of your answer of 16.1057? because I can find NO combination of that equation that renders that.