On 8/04/2009, at 2:31 PM, Roslina Zakaria wrote:


Hi Rolf,

I would like to extend the problem that I asked you before regarding the newton method using 4 functions with 4 parameters. My functions involve the modified bessel function of the first kind which I can type them without any problem.
The big problem is the Jacobian matrix.
I use Maple 11.0 to get the algebraic expression for the Jacobian matrix. The problem is that the Jacobian matrix is so complicated and it is quite impossible to type the expression as I end up of more than 50 pages for the algebraic form of the Jacobian. Can you suggest any method to solve the problems?

I'm a frayed knot. I would suggest that if you really need to do this then you use some other numerical optimizer (optim(), nlm(), nls(), ...). These don't necessarily
require an analytic expression for the Jacobian.

If this is another homework exercise that *insists* that you use Newton's method, then
you're in a bit of a bind.

There are two possibilities that I can think of.

One is to program up your own numerical Jacobian calculator, and instead of having your objective function return the analytic expression for the Jacobian at the current parameter values, have it return the numerical approximation to this Jacobian. This would be dicey; calculating such a numerical approximation requires a substantial background in numerical analysis. I wouldn't want to try
this myself.

The second poss. is to get Maple to return the expression for the Jacobian as Fortran code (which I *think* Maple will do --- but don't quote me on this! I'm not a Maple user.) You can then compile and dynamically load (see ?SHLIB and ?dyn.load) the Fortran code and call this inside your objective function, using
.Fortran(). (See ?.Fortran .)

This would be much safer than the first possibility, and is the way I would go
(given that Maple will return Fortran code) but it requires you to come
to terms with the use of .Fortran() which is a bit demanding of the beginner
(as I gather you are).

If this is indeed a homework exercise, then your instructor should be giving you
(quite) a bit more guidance, IMHO.

Good luck.

        cheers,

                Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to