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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

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

Andy_C
10-Marble

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.

Andy_C_0-1679169965685.png

 



 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

9 REPLIES 9
Werner_E
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.

Andy_C
10-Marble
(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.

Andy_C_0-1679250711401.png

 

Werner_E
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.

 

Andy_C
10-Marble
(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.

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.

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

Andy_C_1-1679251194019.png

 

LucMeekes
23-Emerald III
(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

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

Top Tags