I am creating a program that calculates the temperature distribution of a slab based on some boundary conditions using Visual Basic. During the development, I need to solve equations like this one:
tan(x*L) = x * (H1 + H2) / (x^2 - H1*H2)
You can do this with a nonlinear solver and I'm sure there are solvers that have an interface you can use from VB. Alternatively you can write a file and call a solver as a subprocess.
Here's an example in AMPL that illustrates the idea:
# test.ampl param H1 = 3; param H2 = 4; param L = 5; var x >= 0.1; # set lower bound to 0.1, because 0 is a trivial solution s.t. c: tan(x*L) = x * (H1 + H2) / (x^2 - H1*H2); option solver knitro; solve; print x;
this produces the following output:
KNITRO 9.1.0: Locally optimal solution. objective 0; feasibility error 6.08e-11 6 iterations; 7 function evaluations Objective = find a feasible point. 1.701346690729009