Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Dear All,
I'm trying to use the Minimize function inside a used defined function and I'm getting the following error "The variable is undefined" but outside the function it works very well.
As you can see the function was get from the Examples from the mathcad help my problem is similar to the one on the attached file.
Thanks in advance,
Lourival
Solved! Go to Solution.
Dear Valery,
Thank you for your suggestions I found it useful also I found another way to get around this. Discussing with a PTC support I got the followoing suggestion.
Please let me know.
Thanks in advance,
You cannot build a solve block inside a program.
Dear Fred,
Thanks for your prompt answer, but I found it a little bit stranger because I already build a solve block inside a program, but was with the function Find, is it still fits the answer? Otherwise how could I get around this issue?
Thanks
You can create a function using a solve block:
Given
(P(T) := Find(x,y)
Then use P(T) inside a program.
If you have an example of a Given/Find solve block inside a program, please post it.
Dear Fred you were right I made a confusion looking at my files the Find function I defined outside the program in order to test the calculation procedure and then I implemented it via root inside the program
Fred, I found a different solution to the problem of Minimization, please check the post let me know what you think about.
Regards
We can use the Minimize/Maximize function without the Given keyword.
In a program too.
But see a very interesting error - 2 is a number not a variable:
Dear Valery,
Following your suggestion and Fred I defined the function like the figure below
As you can see the Minimize function is used outside the program and also I parametrize the function that I should use.
Also went a little bit deeper by parameterizing the constrains also, and this is my aim using the Minimize function. I would like to run a small program with a variation on the constrains minimizing for each case via For or While.
Any ideas?
Lourival Mendes wrote:
Any ideas?
You can use an user function for the minimum finding and with constrains.
One example one simple user function for the minimum finding without constrains:
http://communities.ptc.com/videos/1460
And no problem to insert constrains in this function.
Dear Valery,
Thank you for your suggestions I found it useful also I found another way to get around this. Discussing with a PTC support I got the followoing suggestion.
Please let me know.
Thanks in advance,
This is the correct way to do it.