I designed this simple circuit here : enter image description here

as it can be seen the software shows \$-8.572pV\$ (I assume it means pico volts).

But shouldn't it be \$0V\$? Is this some kind of error due to computers being limited to finite bits or something?

Also can I get this to \$0\$ or is this the best I get?

  • \$\begingroup\$ What did circuit analysis tell you the voltage would be? I mean, I'm not about to go through and analyse this - you should do this. \$\endgroup\$ – Andy aka Nov 1 '20 at 13:46
  • 2
    \$\begingroup\$ Some rounding error is to be expected. \$\endgroup\$ – user_1818839 Nov 1 '20 at 13:47
  • \$\begingroup\$ @Andyaka I did get zero using pen and paper calculations, if that's what you mean. should I post my workings here? \$\endgroup\$ – Hrishabh Nayal Nov 1 '20 at 13:50
  • 1
    \$\begingroup\$ Different simulator solve diffrently the circuits. But at the core, they are numerical solvers, so what @BrianDrummond says is true, so when you see pV or fV, or so, expect that to be a residual. \$\endgroup\$ – a concerned citizen Nov 1 '20 at 13:51
  • 2
    \$\begingroup\$ @HrishabhNayal I'm sure your teacher understands what a numerical solver is and what limitations it can have. \$\endgroup\$ – a concerned citizen Nov 1 '20 at 13:55

Bob Pease would approve of this exercise...

What's all this Spicey stuff anyhow?

Expecting perfect output from a simulator using numerical methods is just not realistic : and placing absolute trust in SPICE simulations (which are models of analog reality, not reality itself) is a serious mistake.

When you have finished this exercise you will understand...

Present your pencil and paper answer as the exact solution; and present the fact that your simulation is in very close agreement with it as supporting evidence.

And just for fun, calculate what precision of resistors you would need to build this and get less than 10 pV error. Then try to find those resistors for sale online...

Or change just one of those resistors by the smallest tolerance you can find, and re-simulate. Notice how far off the result is now, compared with the rounding error.

In real life, sometimes you need better supporting evidence in physical form... again from the legendary Robert Pease.

enter image description here (not Bob Pease, but one of his prototype : the very first LM317 linear regulator!)

  • \$\begingroup\$ Upvoted just for that fun article. The old style parts really drive home how old those ICs are. \$\endgroup\$ – Spehro Pefhany Nov 1 '20 at 21:51

Is this some kind of error due to computers being limited to finite bits or something?

You got it.

The SPICE software will reduce the network to a collection of equations, and each equation will typically multiply or divide currents/voltages by resistances. Notice your current sources. 3 amps and 6 amps. Unless all of your resistances are multiples of 3, when you divide you're going to get values like 1/3, 2/3, etc. And look at R2/R3. You're going to get a factor of 2/3 when you compute the parallel resistance.

And guess what? 1/3 is irrational. It cannot be exactly represented by any finite number of digits or bits.

So, at some point in the computations, the SPICE software will take the nearest approximation allowed by its numerical format (floating point, in this case) and use that. This will introduce one or more (very slight, hopefully) errors. Those errors will propagate through the following calculations, and you'll get (again, hopefully very small) errors in the final results. Note that, depending on exactly how the computations are structured, 3/3 does not (necessarily) equal 1. If 3 is multiplied by 1/3, and 1/3 is only approximately correct, then the final result will only be approximately correct as well.

There is another way to do this. It's possible to build a system which essentially sets up the equations and them solves them symbolically. Think of Wolfram. There are other problems which crop up, and the software will tend to be much more complex, but it's possible in principle.

  • \$\begingroup\$ "1/3 is irrational" on a base 2 system right? \$\endgroup\$ – Hrishabh Nayal Nov 1 '20 at 14:36
  • 2
    \$\begingroup\$ @HrishabhNayal Yes, but if you're using a Base 3 computer, something else like 1/2 will be irrational instead. \$\endgroup\$ – user_1818839 Nov 1 '20 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.