Message Boards Message Boards

2
|
10055 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Need help to speed up code to find root of determinant

Dear all.

I’m solving for the root of a complex determinant in a loop function. Due to the multiscale origin of the problem, I have to include a large number of digits (700!), which makes the root finding procedure relatively slow since I have to include arbitrary precision numbers. If you have a look into the attached example notebook, it takes about 5.7 sec to calculate the matrix Mtemp (which is the result matrix). I’m not so familiar with Numerics in Mathematica, and thus I would like to ask if someone could help me to speed up the code to get simulation time substantially down. Maybe there is a trick which I missed so far.

All the best,

Markus

P.S.: The example attaches refers to a 4-layer optical slab waveguide in TM polarization with symmetry plane in the center of the structure. Using this notebook, the wavelength dependence of the effective mode index of the fundamental mode can be traced.

Attachments:
POSTED BY: Markus Schmidt
3 Replies

Dear both.

Thanks for your responses. Daniel, it really helps to speed this up, thanks for that. Do you think if there is any way to speed up the code even further, maybe by manipulating the module? I recently found out that Mathematica seems to be really slow if arbitary precision numbers are combined with Bessel functions, which I need to use for another waveguide problem. Is there any solution to this? Thanks again, Markus

POSTED BY: Markus Schmidt

I find that setting Method -> "Secant" gives an improvement in speed, roughly a factor of 4. For this one needs two start values; I used {nRss,.9*nstart,1.1*nstart}.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

Hi Markus,

Isn't an assignment missing for nRss in the routine Mloop?

POSTED BY: Xavier Roy
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract