Message Boards Message Boards

Does "FindRoot" work with numerical functions?


I have a problem with FindRoot, I want to find the root of a function but it consist of two parts, an analytical function and a numerical function, for example: imagine I have f1(x)= x that's my analytical function but the other one it doesn't depends on a variable it just print me a number when I call it, if I do f2(1.2)=5.6 for say something, but i can not do f2(x) that is not how is built my second function, it doesn't have a known shape because is quite complicated so is a numerical approach.

The thing is I want to solve this two equations for Liquid-Vapor equilibrium, there are 2 equations and this two depend on two functions, one analytic ant the other numeric, as I explained before, I don't show how they depend because the code is large and complicated, but in the document I attached, you can see in a good way what I want to solve.

p[ T, \[Rho]V] == p[ T, \[Rho]L],
    \[Beta]\[Mu][ T, \[Rho]V] == \[Beta]\[Mu][ T, \[Rho]L]

Thank you and I hope you understood my problem.

POSTED BY: Charls Mejía
16 days ago

Please first create a toy example of the problem you are seeing. It should be very simple. This will help you work out what you need to do.

In general, you need to do the following:

(1) First, create a function that is equal to 0 for the solution you want.

(2) Use ?NumericQ as documented here (

(3) Use FindRoot.

The notebook you have attached doesn't have enough information in it to help. There are missing definitions and it's too complicated of an example.

POSTED BY: Sean Clarke
15 days ago

Thank you, I saw the ?NumericQ and it worked, it seems that FindRoot didn't know that I had a numerical function until I appended the ?NumericalQ, suddenly it worked.

POSTED BY: Charls Mejía
4 days ago

Group Abstract Group Abstract