Message Boards Message Boards

0
|
6293 Views
|
6 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Avoid error in a FindRoot?

Posted 4 years ago

A series of Mathematica Notebooks were published in the book written by Mehrdad Mehdizadeh, "Microwave/RF Applicators and Probes for Material Heating, Sensing, and Plasma Generation, 2nd Edition", Elsevier, 2015. I am working on getting the Notebook running found in Appendix A4.2, which I attached to this message, and it can be found on pp. 381-383 of the book. I have encountered a problem getting the FindRoot statement to work in this Notebook, and need some assistance identifying the source of the problem, as well as a method to fix it. The following Notebook is also attached to this posting:

enter image description here

The Notebook runs without any errors until it encounters the FindRoot statement, where it issues the following error message:

enter image description here

The Notebook that produces this error message is attached to this, so can anyone tell me where the error is located that is causing this problem to occur, and tell me how to fix it? Posting the corrected code would be very beneficial.

Thanks in advance,

Scott

POSTED BY: Dr. Scott Best
6 Replies

Dear David and Jim,

Thanks again for your assistance yesterday with debugging the Mathematica Notebook. The complete Notebook is debugged and running properly and is attached for your reference.

Thanks again,

Scott

POSTED BY: Dr. Scott Best
Posted 4 years ago

Hi Scott,

There are two syntax issues in your code. In the definition of mu0, there is no space between Pi and 10, which makes it a symbol. Also in the definition of k Pi f occurs with no space. When I correct these I still get a FindRoot error indicating it thinks the MaxIterations option is a search specification. I don't understand that -- it looks like good syntax to me. But when I eliminate that option I get a solution not exactly but very close to zero.

I attach a revised notebook.

Kind regards, David

Attachments:
POSTED BY: David Keith

Dear David and Jim,

Thanks for flagging the typos that I missed while debugging the Mathematica script, and that seems to have fixed part of the problem. I also retype set MaxIterations -> 50 in the FindRoot line, but this produces a new FindRoot Error seen as: enter image description here

The Notebook was created before the 1st Edition of the book was printed in 2012, and the Notebook was not changed when the 2nd Edition was printed in 2015. I am not actively using Mathematica these days, even though I used it rigorously when V1 was released for performing the Symbolic Integration of 2D waveguide cross-section fields. The integrals would normally take 30-days to do by hand with the CRC tables, and then converting the final equation into Fortran. Sign errors were always troublesome, but Mathematica expedited that work 30x for me and produced Fortran code when the Symbolic Integration was completed.

I wish Mathematica provided more information for errors, particularly for typos, but it fails miserably. I thought I could get this Notebook running in a few days, but that has not worked out for me. In conclusion, if you look at the attached Notebook with the typos I missed corrected, do you know what could be causing the new FindRoot error message to be created?

Thanks in advance,

Scott

Attachments:
POSTED BY: Dr. Scott Best
Posted 4 years ago

Mathematica does tell you that $\pi f$ is undefined as it shows up in blue. Same for $\pi 10$.

POSTED BY: Jim Baldwin
Posted 4 years ago

Dear David and Jim,

Thanks for your help, but fixing the typos seemed to fix the error I was experiencing. I will post the complete Notebook for everyone tomorrow once I verify that it is working properly.

Thanks,

Scott

POSTED BY: Updating Name
Posted 4 years ago

There are a few typos. In a few places there is $\pi f$ and $\pi 10$ which should have a space between the two characters. Also, the MaxIterations -> 1000 has some invisible character so just delete that and type it back in and things should now work.

POSTED BY: Jim Baldwin
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