# Can we predict Simulation?

• posted

Hello,

This question may seem strange to you, but it is of very huge significance for me. Can we predict, if a circuit will simulate or not looking at the matrix formed? The AX=B which the iterative or direct solvers in SPICE use, I want to know if given A and B. Is there some mathematical operation that can be performed to know that a) a solution will exist? b) if a solution exists, will it converge to the correct answer? c) will it converge to an answer at all?

These questions mean a lot to my thesis work and I shall be really really thankful if someone can answer this

Thank you, Dilip

• posted

Numerical Methods in Engineering with Python by Jaan Kiusalaas provides the following information.

On page 28 the book says "A system on n linear equations in n unknowns has a unique solution, provided the determinant of the coefficient matrix is nonsingular; that is |A| is not equal to 0.".

Page 85 in the book provides the following guidance when using iterative methods to solve a system of linear equations. "A serious drawback of iterative methods is that they do not always converge to the solution. It can be shown that convergence is guaranteed only if the coefficient matrix is diagonally dominant. The initial guess for X plays no role in determining whether convergence takes place--if the procedure converges for one starting vector, it would do so for any starting vector. The initial guess affects only the number of iterations that are required for convergence."

Page 158 and 159 in the book provides the following guidance when using the Newton-Raphson method to solve n simultaneous nonlinear equations, "The simplest and the most effective method of computing X is the Newton-Raphson method. It works well with simultaneous equations, provided that it is supplied a good starting point. There are other methods that have better global convergence characteristics, but all of them are variants of the Newton-Raphson method. As in the one dimensional case, suceess of the Newton-Raphson method procedure depends entirely on the initial estimate of X. If a good starting point is used, convergence to the solution is very rapid. Otherwise, the results are unpredictable."

Hence, I conclude the answer is yes if you have a system of linear equations but the answer is no if you have a system of nonlinear equations.

You also might want to post your questions in the Sci-math.num.analysis group to see what the numerical method pros there say.

Howard

Dilips wrote:

• posted

Hello Howard,

Thanks for your answer. That was a very useful excerpt from the book. I understand that it helps with linear equations but is not the case with non-linear equations. Another question now would be, how good is it if that knowledge is known for linear equations alone.

hrh1818 wrote:

• posted

The book covers a lot more than linear equations. The book covers all of the topics that are typically covered in a first course in numerical methods. Topics, like Systems of Linear Algebraic Equations, Interpolation and Curve Fitting, Roots of Equations, Numerical Differention, Numerical Integration, Ordinary Diffrential Equations, Two Point Boundary Value Problems, Symmetric Matrix Eigenvalue Problems, and an Introduction to Optimization.

I am not sure what you mean by "knowledge known for linear equations alone". However, as any circuit that contains a semiconductor will be modeled by a system of nonlinear equations and as provided by the guidance given on pages 158 and 159 by Jaan Kiusalaas in his book if you make a bad initial guess for the approximate solution to your system of nonlinear equations you won't be able to tell ahead of time if your numerical method will converge on a solution.

Howard

• posted

Howard,

Interesting... he has the same book for Matlab as well! Do you happen to have access to both and, if so, could you provide a comparison? I've done some "objected oriented" programming in Matlab and, while I'm actually rather impressed with how object oriented Matlab can be given what roots it began with, clearly Python is a much more sophisticated general purpose programming language... but I figured that in Python you'd immediately miss out on many of the powerful built-in function in Matlab, such as the graphing tools and of course all the toolkits.

---Joel

• posted

There is a python wrapper for gnuplot

PyMat - An interface between Python and MATLAB

There is NumPy The fundamental package needed for scientific computing with Python is called NumPy

Octaviz might be interesting:

```--
These are my opinions, not necessarily my employer\'s.  I hate spam.```
• posted

Joel,

I don't have access to the Matlab version of Jaan Kiusalaas Numerical Methods book. However, I made a quick comparison at Amazon.com. Both books cost \$85, both books have approximately the same number of pages, exactly the same topics are listed in the table of contents, and a quick check of the index indicates both books cover the same topics. Hence I strongly suspect the only differece between the two books is one book uses Matlab m files and the other uses Python script filles.

Jaan kiusalass does not make use of the object oriented features of Python. Instead each script file is a procedure. At one level Python can be an easy programmng language to learn. But it also can appear to be mysterious as it can compress a lot of action into very few lines of code.

Certainly if you are looking for tools or books to help you solve problems in an unusual engineerig or science field than Matlab beats Python. But for general numerical analysis the performance of Python and numpy compare quite favorably with Matlab. And of couse the diehards who post on the Python NewsGroup will tell you Python and numpy are free.

Howard