Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I'm curious if anyone has come up with a solution that is similar to using Find() w/in a Solve Block OUTSIDE of a solve block?
I ask because I'd like to have the Find() ability to iterate/solve but use it as a custom function that I can call for N instances.
There is a lot of value in Solve Block Find() but I have a case where I have a lot of inputs in V for which I would like to Find() solutions. I don't see this working just using a Solve Block.
Solved! Go to Solution.
You have only one equation.
Better to use not the Find function with the Solve block but the root one - with 2 or 4 arguments.
You can turn the solve block into a function and the use this function in your program.
In the example you showed, the only thing you could vary is the guess value.
You may delete the c.g:=1 in region and close the solve block with get_c(c.g):=Find(c.g)
Not get_c(1 in)= gives you the value shown in your picture but you could also try different guess value - maybe get get_c(10 in)= yield another solution.
Thank you Werner! I believe this would have worked as a viable solution but I am not able to define the 'get' function. In any case, @ValeryOchkov 's root method worked so I am going to explore that more.
You will have to delete the "=" evaluation after the "find" command.
I thought that the solve block you show would be just a simplified example of what you are really trying to achieve because you wrote something about various input variables you would like to vary.
Ok, that was silly. Naturally, when I remove the "=" it works.
The solve block I showed is actually how I was solving this iteration before, and, it worked great for one set of inputs. Moving on to an expanded version where the inputs will vary is where I was uncertain. I haven't tried the next step yet with having a set of inputs but either the solve block Find() or root should work.
You have only one equation.
Better to use not the Find function with the Solve block but the root one - with 2 or 4 arguments.
Apart from the two methods described by Werner and Valery, there is another method:
Solve your equation symbolically, assign that symbolic result to a function and feed your N scenarios to the function.
Success!
Luc
Thank you @LucMeekes , this situation is an iteration of 5 different functions so I am not sure about solving it symbolically.