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

6-Contributor

## Is there a way to use Find() outside of a solve block?

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.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby III
(To:Andy_C)

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.

9 REPLIES 9
24-Ruby V
(To:Andy_C)

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.

6-Contributor
(To:Werner_E)

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.

24-Ruby V
(To:Andy_C)

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.

6-Contributor
(To:Werner_E)

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.

24-Ruby III
(To:Andy_C)

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.

6-Contributor
(To:ValeryOchkov)

Excellent, thank you @ValeryOchkov !! That worked. I am going to test it out some more.

24-Ruby III
(To:Andy_C)
23-Emerald II
(To:Andy_C)

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

6-Contributor
(To:LucMeekes)

Thank you @LucMeekes , this situation is an iteration of 5 different functions so I am not sure about solving it symbolically.

Announcements