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

Excel/VBA Help?

Newbie

Excel/VBA Help?

I know that this is technically a Mathcad forum but I have been stuck on an Excel issue for about 3-4 weeks now and I have no idea how to fix it.

I was given a differential equation with an initial condition and a boundary condition. I was suppose to guess an initial condition in place of the boundary condition, then use bracketing and the Brent method combined with the Runge-Kutta method to adjust my guessed initial condition to solve the equation and have it match the given boundary condition.

What I did was guess the initial condition, plug it into my Runge-Kutta method to give me some answer, check that answer with my boundary condition, then use the bracketing and Brent method to adjust my guess and resolve it with the Runge-Kutta. The problem I am having is that the program keeps taking an exponent of a negative number which gives a run-time error 5 when dydx(1) is evaluated. I don't know if I can just put in a safety statement saying if the variable is less an 0, make it 0.

I attached my excel program with the VBA coding, maybe some one can take a look and give me an idea of what I am doing wrong or how to possibly fix it?

Thank you!

Tags (2)