Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
please help to solve the problem.
for each TK i need solution.
for individual Tk, over range of n, i want minimum value.
Thanks in advance.
Regards
Prabhu
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.
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
Like the attached?
i want output in the form of "Timo_Pcr(TK)", output will have 60 values
Why?
prabhu g wrote:
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
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
I can't seem to figure out why my sheet is returning different results to yours.
Although I do like your method better.
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.
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.
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.
Good spot