marcel hendrix <m…@iae.nl> wrote:
> I'd like to add a symbolic solver to my iSPICE and SIMPWL network > analysis tools. Such a solver is able to return, e.g., the solution to a > voltage divider (R1=9k, R2=1k) across a voltage source (V1=10V) as > "V1*R2/(R1+R2)" instead of as "0.1". > > I remember, but absolutely can't find anymore, a paper/book that showed > how to do this by defining a peculiar loss-free transformation of the > input values. AFAIR, it scaled values such that their bit-patterns did > not overlap. (Yes, there probably is a link with current CLF threads on > variable precision floating point and lossless number input and output). > It was then possible, maybe with limitations, to disassemble the > rational number output "0.1" (or maybe "1 / 10") back to the formula > "V1*R2/(R1+R2) => (10 * 1k) / (1k + 9k)" by identifying the products, > sums, and ratios of 10, 1k, and 9k. > > Of course this was a very old paper.
In general this looks equivalent to symbolically solving systems of linear equations. More precisly, given a passive linear circuit with symbolic values of elements one can write a system of linear equations which deterimines symbolic solution. OTOH, given a system of equations (possibly with some mild restrictions), I think that one can find passive linear circut such that solving the circuit gives solution of the linear system. Symbolically solving systems of linear equations is a well developed business. The easiest, but least effcient way is to implement arithmetic on rational functions and use it say in Gaussian elimination. Typically so called modular methods are more efficient. There are many variant of such methods. Basic idea is that you plug in numeric values for symbolic parameters, solve numeric system(s) and try to reconstruct anwer from results of evaluation. One approach uses single evaluation point. If your aswer has one symbolic parameter and is a polynomial of known degree in this paramenter then to get the answer you need to determine coefficients of the polynomial. Trick here is to notice similarity between polynomial and expansion of a number in a base. Given say P(X) = a*X^3 + b*X^2 + c*X + d you can plug in some number for X and treat is as base in which you can write any integer. If the base D is bigger than 2 times max of absolute values of a, b, c, d, then you can find values of a, b, c, d from the values of P(D). Similar approach works for multivariate polynomials, say in variables X and Y. You just need to substitute D^n for Y, where n is bigger than any power of X which may appear in the answer. In general the answer will be not a polynomial but a rational function. Here one can use so called rational reconstruction, which given value of a/b modulo N can reconstuct a and b as long as they are relatively prime and 2|ab| < N. This approach quickly leads to very large numbers, so you need efficient arithmetic on large numbers. There are also so called bad reductions where you either get division by zero in intermediate calculaions or the final answer is wrong. So you need to check result for correctness and if needed repeat calculations plugging in different values. Modern software typically uses multiple evaluation points, as this allows working with machine integers. There are many tricks to improve speed, so corresponding software is pretty complicated. Above concerns that case when you want exact rational values of coefficients. If you want floating point approximation, then you can plug in several sets of values for variables and then solve resulting interpolation problem. This is somewhat similar to symbolic case using multiple evaluation points, but corresponding calculations may be numerically unstable and you are faced with problem of deciding if sumething that is numerically close to zero is really zero. There were proposals for methods that are more stable numericaly, but need more computations.
> It would be acceptable if only one, or a few, component values are > symbolic and the rest numeric, as for even modest size circuits the > truly symbolic output becomes so voluminous that all insights on the > physical circuit behavior are lost anyway.
-- Waldek Hebisch