cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

1-Newbie

## Solve Block

for each TK i need solution.

for individual Tk, over range of n, i want minimum value.

Regards

Prabhu

11 REPLIES 11
4-Participant
(To:ptc-2315322)

What does the the value n represent in your program and why have you started the for loop with a value of n = 2?

n should vary from 2 to 18, i want the lowest value from the loop for individual Tk.

4-Participant
(To:ptc-2315322)

Like the attached?

I would recommend not to redefine variables which have been designated to represent units, i.e. R in this case.

first case Tk=15mm

than n should vary from 2 to 16, for each value of n pressure_critical will be different

so, pressure_critical will have 15 values for one Tk, output should be least of the pressure_critical

than Tk will be 16mm, program repeats

i want output in the form of "Timo_Pcr(TK)", output will have 60 values

4-Participant
(To:ptc-2315322)

Like the attached?

 i want output in the form of "Timo_Pcr(TK)", output will have 60 values

Why?

24-Ruby IV
(To:ptc-2315322)
 prabhu g wrote:first case Tk=15mmthan n should vary from 2 to 16, for each value of n pressure_critical will be differentso, pressure_critical will have 15 values for one Tk, output should be least of the pressure_criticalthan Tk will be 16mm, program repeatsi want output in the form of "Timo_Pcr(TK)", output will have 60 values

So write your function to work for 1 scalar input value and return 1 scalar and then call it with a vector as argument and use vectorization - thats what vectorization is for.

See attached

4-Participant
(To:Werner_E)

I can't seem to figure out why my sheet is returning different results to yours.

Although I do like your method better.

24-Ruby IV
(To:MikeArmstrong)
 Mike Armstrong wrote:I can't seem to figure out why my sheet is returning different results to yours.

Because you used a different formula 😉

You have n+2 instead of just n in the first denominator.

But I just realized that I, too, did not use prabhu's original sheet as I worked off one of your sheets and obviously you had changed his routine.

So here is the routine using his original sheet.

4-Participant
(To:Werner_E)
 Werner Exinger wrote:Because you used a different formula 😉You have n+2 instead of just n in the first denominator.

Oh so I did . The issue was that I didn't subtract CA from Tk. I also removed R and Tk from the program as I didn't seen the need to locally define them.

 Werner Exinger wrote:So here is the routine using his original sheet.

Here is my attempt using a nested FOR loop for completeness. Results now agree.

24-Ruby IV
(To:MikeArmstrong)
 Mike Armstrong wrote:Werner Exinger wrote:Because you used a different formula 😉You have n+2 instead of just n in the first denominator.Oh so I did . The issue was that I didn't subtract CA from Tk. I also removed R and Tk from the program as I didn't seen the need to locally define them. Werner Exinger wrote:So here is the routine using his original sheet.Here is my attempt using a nested FOR loop for completeness. Results now agree.

Yes, and with your approach you may omit the local variable critical_pressure completely as its not needed for initialisation of the minimum.

4-Participant
(To:Werner_E)

Good spot

Announcements
Check out the latest