Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Please,
I need export results of functions to a vector or Excel table. I can not work with vectors instead range variables because I have a lot of functions depending of these range variables. After made calculations, I have a function results (with a lot of singularities) and I need find max and min values from these results. I need convert these results to a vector, so, I can use max and min functions to find the maximum and minimum values or export these values to Excel.
Someone have any solutions to this case?
Thank you.
Solved! Go to Solution.
Now you have posted this very same question three times in different threads - thats annoying and counterproductive. Please avoid doing this in case of future questions.
Attached is something which should help for your understandig, I hope.
You can give a function a vector just as well as a range variable.
Now you have posted this very same question three times in different threads - thats annoying and counterproductive. Please avoid doing this in case of future questions.
Attached is something which should help for your understandig, I hope.
Werner,
Thank you. Your explanation was perfect.
Werner,
When the functions have more than 2 variables I can not assembly a matrix to find the max and min values. Can you help me?
Find attached a e.g.
When the functions have more than 2 variables I can not assembly a matrix to find the max and min values.
Yes, unfortunately Prime does not support multidomensional arrays.
So as I see it you have two options:
1) Create a different datastructure, e.g. a onedimensional vector (similar to whate the use of range variables would yield). You may use a tricky way with the three range variables or a small programm (preferrable) to do so. I guess a matrix with 4 columns (the three arguments and the function value) and (in your case) approx., 3 millions rows would be a good choice. You would use three nested for loops to do so. The use min() and max()
2) Write a routine (again three nested for loops) which only returns the min and max value (and if you need the three arguments which yield those values) without creating that huge structure.
Werner,
I found something about assembly a matrix to determine all combinations of four variables in the link http://communities.ptc.com/message/201635#201635 but I can not understand the procedure because the woksheet is very complicated. Please, can you help me to write a programing to assembly the matrix as you suggested in option 1 or create a routine as you suggested in option 2?
Thank you very much for your time and effort.
Sorry, I don't see what you have tried and what didn't work. The last two pages are empty. Probably you sent a wrong version of the file as it seems to be the same you sent two days ago.
Werner,
Please disregard the last two pages, they are really empty. Consider only the page 3/3 of the new file attached. I need find max and min values for the function Fnie03 (B1, H1,D1) and your arguments.
Thank you.
Thats the same file posted for the third time, you just deleted the expressions on the right hand side pages.
But I still don't see what you have tried so far to come to a solution and so can't tell where or why it failed. What have you done so far? The link you posted shows how to deal with nested for-loops. Problem in your case can be that you may run out of memory dealing with matrices with some millions of elements.
Werner,
I did not tried nothing at this moment. I do not know write a routine to find the max and min values or a program to assembly the matrix (three colums with arguments and one column with results). I need your help to give me a e.g. how I can do this.
Thank you for your patience.
How about a different approach. Note that you have discontinuities and more than one maximum, so the guess values matter.
OK, just for the completeness sake find attached the brute force way of searching for the maximum using the range variables you provided. I haven't bothered implementing the other method (creating the complete table with all values).
Richard had already posted what seems to be the best solution for your problem - using a solve block.
Some remarks:
It goes without saying that you will have to check all modifications for consistency and correctness.
See my answer here: http://communities.ptc.com/message/241799#241799
Please do not cross post. It is a waste of our time for multiple people to answer your question because they didn't realize it was already answered somewhere else.