Skip to main content
12-Amethyst
March 18, 2023
Solved

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

  • March 18, 2023
  • 3 replies
  • 2556 views

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.

Andy_C_0-1679169965685.png

 



 

Best answer by ValeryOchkov

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.

3 replies

25-Diamond I
March 18, 2023

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.

Andy_C12-AmethystAuthor
12-Amethyst
March 19, 2023

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.

Andy_C_0-1679250711401.png

 

25-Diamond I
March 19, 2023

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.

 

24-Ruby IV
March 19, 2023

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.

Andy_C12-AmethystAuthor
12-Amethyst
March 19, 2023

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

Andy_C_1-1679251194019.png

 

23-Emerald IV
March 19, 2023

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

Andy_C12-AmethystAuthor
12-Amethyst
March 19, 2023

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