Bignum calculator

The problem that triggered this was to determine if a 48-bit dds was good enough to generate the offset frequencies to detect the center frequency of a Rubidium clock at 6,834,682,610.904 Hz.

If we start with a 200 Mhz, clock, the step size is

200e6/2^48 = 0.000000710542735760100185871124268 Hz

Now generate a clock at 68.34682610904 MHz and add the offset

0.000000710542735760100185871124268 + 68.34682610904e6 = 68346826.1090407105427357601 Hz

Multiply by 100 in an integer pll such as the ADF4108 to excite the Rubidium atoms in the microwave cavity

68346826.1090407105427357601 * 100 = 6.83468261090407105427357601e+9 Hz

Now subtract the Rubidium target frequency

6.83468261090407105427357601e+9 - 6834682610.904 = 0.0000710542735760100185871124268

Compare to the decimal portion of the target frequency

0.0000710542735760100185871124268 / 0.904 = 0.00007859

Yes, it looks like a 48-bit dds is good enough, so this approach will not require the conventional 127Hz phase modulator to detect the resonance.

This shows the required offset frequencies can be generated in the dds with sufficient accuracy after multiplication up to the target frequency. This eliminates the drift in the phase modulator, and the phase noise from the SRD comb generator and following amplifier stages.

Now, I realize the above calculation could be simplified, but I want to see the actual frequencies at each step in the process. Also, the C-Field required to see the dip at the Rubidium resonance and the buffer gas in the Rubidium cell will shift the frequency 3 or 4 KHz. But that's ok. I just want to see if the dds approach is worth investigating, and yes, it is. But the calculations are not possible in an ordinary calculator since it truncates the result.

One thing that helps the calculation is the Calcpad editor in TTCalc. You can copy and paste back and forth to a plain text editor to document each step in the calculation and figure what to do next, then save everything to a text file for later reference.

The next step is to repeat the calculation to see if a 32-bit dds would work. The ability to cut and paste makes the calculation quick and easy.

Here's the quick result

200e6/2^32 0.04656612873077392578125 + 68.34682610904e6 68346826.1556061287307739258 * 100 6.83468261556061287307739258e+9 - 6834682610.904 4.65661287307739258007656391 / 0.904 5.15112043482012453548292468

The result shows a 32-bit dds would not work.

Reply to
Tom Swift
Loading thread data ...

Given that the stick is made of atoms, there are a finite number of different places that a mark can be made on it. My intuition is that that number is small compared with the number of ASCII sequences that could have existed in an encyclopedia the length of the Britannica, and that there is a vanishingly small chance that it's possible to make such a mark.

Sylvia.

Reply to
Sylvia Else

the exact result is likely to have a > 7 billion digit repeating decimal part, your scriptig language is fine with that?

--
umop apisdn
Reply to
Jasen Betts

On a sunny day (Sun, 21 Dec 2014 16:54:02 +1100) it happened Sylvia Else wrote in :

What you know 'bout aliens huh? We only are down to quarks now, they...

Reply to
Jan Panteltje

You specify the desired precision. I've experimented with approaches where I dynamically vary the precision -- based on the results of each calculation. But, there's no closed form solution to this problem so you have to rely on the user's judgement/discretion.

*But*, you don't have to start off with, e.g., 17 digits -- you can just as easily let the default be 100 digits (BigDecimals only grow to the size that's needed so '1' takes less space than 1,234,567,890,123,456,789.

The user eventually has to render the result into a form that "makes sense" to them -- you wouldn't be interested in micropennies (typically).

The point is, not to require them to understand numerical analysis and/or the issues that arise in *imperfect* math packages. So, they can perform a calculation in whatever manner "seems intuitive" to them without wondering why the answer is wonky.

Otherwise, given: 1234567890123456789012345678901234567891

- 1234567890123456789012345678901234567890 and a result of "0" would probably cause them to reenter the expression, again... only to be puzzled as to why the software *still* got it wrong!

E.g., the combination example I gave, up-thread:

C(300,2) is 44850. Yet, if they had simply typed the numbers into a formula: "300! / (298! 2!)" a typical "program" would blow up.

Likewise, solving things like quadratics can lead to errors if you just rely on something as naive as the quadratic formula...

Reply to
Don Y

I work in super linear, super low noise circuitry, we're talking a 0.1 ppm dynamic range. To do simulations and simulate post processing WITHOUT injecting significant numerical noise into the results I NEED more than six digits on my models. Not because I'm trying to accurately predict, but rather looking for [and desiring to preserve] any 'nuances' I can find in order to help develop the algorithm. Much of the post processing incurs a lot of large numbers subtracting from each other, which is prime for injecting numerical noise into results.

I NOT disagreeing with the fact that it's silly to try simulating a circuit to much better than 1%, but rather there are times when you need more accuracy.

Reply to
RobertMacy

(General methods response)

It also pays to know a twinge of numerical methods, or calculus. Put it this way: if you can't figure it out, at least approximately, in your head, let alone convince a pocket calculator to help you with the correct answer, you're doing it wrong, and there is a better way.

Example. Extremely high energy particles have been observed. On the order of several joules. These "OMG Particles" are obviously going quite fast, very nearly the speed of light. Just how fast?

Special Relativity says, E = m_0 (gamma - 1) c^2 for kinetic energy. For E >> m c^2, we can ignore rest mass energy, since it's basically all kinetic at that point.

Using the mass of a proton (a typical and likely example), gamma ~= 6.6 x

10^9.

gamma = 1 / sqrt(1 - v^2 / c^2), so

sqrt(1 - (c^2 * 2.3 x 10^-20)) = v

Windows Calculator has enough precision for a reasonable result: v = 0.99999999999655647382919517299213 [times the speed of light] but you'd need a handheld calculator with over 12 digits to come close.

If you instead expand the difference v = c - x,

c^2 / gamma^2 = c^2 - (c - x)^2 = c^2 - c^2 + 2cx - x^2 = 2cx - x^2

Since x

Reply to
Tim Williams

Well, regarding model parameters, those are almost entirely ratiometric in small values, or disappear by difference and by feedback (e.g., IS and EG disappear as bias factors and don't affect the AC result), or have to do with frequency response (CJx, TTx) which likely are also accounted for by feedback.

Where you will find numerical problems are rapid changes (e.g., switching circuits) and sums and differences where accurate and numerous timesteps are required (e.g., modeling the efficiency of a low-loss switching converter; power goes up and down due to real and reactive components, and must sum to something reasonable). These simulations are difficult because accurate models are required (in terms of the dynamic parameters, such as Cdss and the other capacitances -- the DC transfer function of the switch itself is essentially irrelevant), which as usual, manufacturers rarely provide, and an accurate simulation must be provided.

The numerical accuracy is pretty much ABSTOL, VNTOL, CHGTOL and RELTOL. Of course, if you turn these down, you need finer timesteps, and more iterations. Matrix stability might be a problem too (the enigmatic PIVREL, PIVTOL settings). YMMV; LTSpice for one doesn't make most of these available, for what reason I don't know (is it because they're not ususally needed, or because they're set automatically, or because Helmut just doesn't trust end users with them?...who knows?).

Tim

--
Seven Transistor Labs 
Electrical Engineering Consultation 
Website: http://seventransistorlabs.com
Reply to
Tim Williams

What has that got to do with calculating the step size of a 48-bit dds with a 200MHz clock?

Sorry, I can't do that in my head. And a pocket calculator won't help.

The solution is to find a better calculator and get on with life.

Reply to
Tom Swift

ABSTOL, CHGTOL, PIVREL, PIVTOL, RELTOL, and VNTOL are all available plus many others. Look in "OPTIONS -- Set Simulator Options" in the help file.

Helmut did not write LTspice. Mike Englehardt of Linear Technology is the author. Here is a picture of him on tour with his characteristic hat and red tie:

formatting link

Helmut Sennewald runs the Yahoo LTspice forum and has shown infinite patience to help newcomers learn about LTcpice for many years. It is an unpaid and unsung position. In my view, he has done more to help spread LTspice to more engineers than anyone. The opening page of the forum shows 51,874 members and it seems to be growing exponentially. Just a short time ago, there was less than 27,000 members.

LTspice has also had an impact on this group. Most people who are able to now post LTspice circuits for discussion instead of ASCII diagrams.

Reply to
Tom Swift

Oddly most have more "internal mantissa" 'space' than that which they actually display externally.

Reply to
DecadentLinuxUserNumeroUno

LT Spice has had an impact on the entire industry.

"mouser" owns, makes, and sells an entire EDA package now, and NI was their provider. LT sparked that interest IMO.

It is a strange world.

Reply to
DecadentLinuxUserNumeroUno

On a sunny day (Sun, 21 Dec 2014 19:09:18 GMT) it happened Tom Swift wrote in :

Not sure that is a good thing. In 99% of the cases you only want a circuit diagram. This is not a binary group either. I can link to any cicruit diagram on my site with a simple URL. But for that spice crap I have to do a lot of work to even look at the circuit, yes I can script it, but: Linux wine messes up this system.

Too many slimulations, too little real stuff posted here. You can use the schematic editor by itself and do a screenshot that anybody, also without [LT]spice, can see:

formatting link
formatting link

Or use xcircuit, that makes nice pdfs:

formatting link

And if you REALY are making someting you SHOULD post a picture anyways. blah blah is cheap.

blah blah blah

Reply to
Jan Panteltje

This idiot claims to be into electronics?

Spice crap?

More like Panteltje CRAP. The name is pretty f***ed up too. Great warrior ancestry?

Bwuahahahahaah!

Reply to
DecadentLinuxUserNumeroUno

Sorry; Mike. I don't use LTSpice often or follow the group so I was confused.

It appears the options are present. But they aren't in the config dialog, so good luck on casuals (like me!) knowing where to find them, or what to set them to.

Tim

--
Seven Transistor Labs 
Electrical Engineering Consultation 
Website: http://seventransistorlabs.com
Reply to
Tim Williams

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Nothing, or nothing more than usual?

Though if you like, that should be around... let's see, 2^40 is about

10^12 * 2^8 or 256 trillion. So a step is ~0.004 trillionth, or just a little less, 3.9something rather than 4. Cut off eight zeroes and double it and you have around 0.8uHz (really, 0.78..). An exact step size of course would require more bits in the mantissa, but beyond six or seven digits, you need better than a quartz crystal to bother expressing them. A very clean, NIST disciplined oscillator could of course make almost all of those bits worthwhile, in which case you would need to know all the digits.

I did preface my entire reply with "general methods". As others were offering such comments elsewhere in the thread, and I didn't see any better place to put my reply.

Tim

--
Seven Transistor Labs 
Electrical Engineering Consultation 
Website: http://seventransistorlabs.com
Reply to
Tim Williams

The source is a double oven OCXO.

There is no such thing as a "NIST disciplined oscillator". You are probably thinking of a GPSDO, which is also the final goal.

I can think of one.

Reply to
Tom Swift

SPICE is complex. A common complaint is things are hard to find, especially when you don't know what you are looking for.

LTspice is much easier than other versions of SPICE I have used, but you still have to learn where to find things. Here are some suggestions.

Method 1.

  1. Load the LTspice Help with F1 or click on the Help Menu.

  1. The Search box opens.

  2. Enter the search term or phrase.

  1. "VNTOL" results in ".OPTIONS -- Set Simulator Options". Click on it.

  2. Scroll down to vntol. (Some items are out of order so you have to pay attention.)

  1. Read the Description: "Sets the absolute voltage error tolerance."

Method 2.

  1. Load the LTWiki at
    formatting link

  1. Enter the desired search term or phrase in the search box.

  2. Usually several locations will be listed. You may find the answer in the first few locations.

  1. Some sections are incomplete. If you know the answer, consider typing it in.

Method 3.

  1. There are a number of pdf help and tutorial files online that contain useful descriptions. Try searching google with the term "ltspice help files" without the quotes.

  1. This gave About 117,000 results. Maybe one of them contains the answer you are looking for.

Method 4.

  1. Sometimes you can find the answer directly. For example, search google for "ltspice vntol" without the quotes.

  1. This gave about 475 results. The second one down is at "A list of simulator options (txt, 5k)". The url is

formatting link

  1. Enter the search term in your browser.

  1. This gave the following:

ABSTOL, VNTOL ABSTOL and VNTOL(Volttol) are the absolute error limits for voltages and currents. ABSTOL and VNTOL should be many orders of Magnitude below the voltages and currents in the circuit. Current tolerance .OPTIONS ABSTOL=1e-12 Voltage tolerance .OPTIONS VNTOL=1e-6

  1. Notice that some search results give a slightly different description or one that is more complete. This can often supply the missing piece of the puzzle that makes the concept finally click in place.

Method 5.

  1. Join Helmut's LTspice forum at

formatting link

  1. Some idiot at Yahoo decided to completely rewrite the forum and it is much less useful and much more difficult to use than before. However, you can still get very valuable information.

  1. Enter the search term or phrase in the "Search Conversations" box. This should really be called "Search Messages", but that is my personal preference.

  2. Press Enter to start the search. Do not press the "Search Groups" or "Search Web" buttons. They will take you somewhere else.

  1. "vntol" gave 73 results from messages in LTspice. (See - they changed the term from 'Conversations' to 'Messages.' GRRRRRR)

Method 6.

  1. In the LTspice forum, click on "Files", then go to "Tables of Contents"

  1. Click on "all_files.htm"

  2. Enter the desired search term or phrase in your browser window.

  1. vntol gave

"msg_49361: options VNTOL -vs.- Control Panel Absolute Voltage Tolerance", and

"VNTOL Demo.asc: VNTOL Demo - .option problem?"

  1. Click on the target item and proceed as desired.

Method 7.

  1. Open the search to a general SPICE search. The phrase "spice vntol" without the quotes gave About 7,540 results.

  1. The second item from the top gave "Simulator Options - The Designer's Guide Community", from a delightful tutorial by Ken Kundert. The url is

formatting link

  1. The Designer's Guide is a vast wealth of information on a wide range of topics. The url is

formatting link

  1. It even include links to Tim Williams' acclaimed "Circuit Designer's Companion" and where to buy it. The url is

formatting link

The next problem is how to use LTspice to find what you need to solve a problem. It is especially helpful to find an example of an analysis that you can modify to suit your situation. Since LTspice has become a defacto standard, this can occur more often than you might expect. The problem is finding the right search term.

Some of the methods listed above might help, or you could post the problem to the Yahoo LTspice forum. You have to be careful to word it in general terms - solving a specific engineering problem is frowned on.

Sometimes posting the problem to sed might help. This is an engineering group and solving a specific engineering problem is well within the group charter.

Good Luck!

Reply to
Tom Swift
[...]

I forgot one Method:

Method 8.

  1. Go to the Examples folder in your LTspice directory.

  1. Browse through the different folders, such as

\Educational \Jigs \Pwl \Wurth

  1. Most of the files have names that reflect the purpose. However, some like "DCopPnt.asc" need to be opened and run to figure out what they do.

"DCopPnt.asc" shows how to find the DC Operating Point of an op amp circuit.

Reply to
Tom Swift

I recommend big guns, i.e. the symbolic algebra. I suppose if you're in the money you could use Mathematica, but they are closed source and unfriendly to user-driven development, so I prefer open-source Maxima

(%i3) fpprec:1000; (%i7) bfloat(%pi / 2^64); (%o7) 1.7030607900432772946675980979457873583919881541477735366595626811534469

387331846985792983879121960106857816501155929181849105661519873325175196667174 984221045153337909221834750679014871833075677183273117440480240024420382965117 394415451887084351534986659523366526690339394760639143399606446561062323003641 710831507105986398946302764355403522028247129213696696567173854815141945045138 756087464734125975146350421238550806960996220092184847229056533598102207522728 315084583434057710046314270032518354317364068765366982592685061685780513957492 495817875308275217897873458651601529275766703558372460366473750799669660079252 143219300199155696339898872382664058911096547368999499380503190115270169744577 055212628201937789812470173435496942261307961191258472007476199089803705474305 891436922098909736035360690964166461774177503070700424545900513834005551736949 503349484110168760663307151996870187190894305332776016256436639914675539159209 01264131126882652387406117116431219207050203340134237885506454709494601b-19
Reply to
Przemek Klosowski

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.