"Rheilly Phoull" wrote in message news: snipped-for-privacy@individual.net...

Hi.

I have appended a very handy Perl script I wrote to deal with not knowing all (or having forgot some) of the 1% values. It also finds pairs of values to get closer values than the standard spreads allow. (This is useful when using 0.1% parts)

Run it without arguments for invocation tips. Get Perl at

"John Woodgate" wrote in message news:SrVhs+ snipped-for-privacy@jmwa.demon.co.uk...

Can you reconsider that assertion? I cannot make sense of it, being stuck in the following thought pattern: If there are 96 distinct values per decade, then for each

96 value steps, a whole power of ten is traversed. Expressed mathematically, (and ignoring the rounding necessary to get standard values), the E96 set can be obtained as 10^(N * log10(10) / 96) == 10^(N/96) for the 96 integer values of N from 0 to 95. This corresponds to a multiplicative interval equal to the
96th root of 10, not the 97 root.

In addition to the problem outlined above, what you say is contrary to the algorithm that I successfully applied to devise the program I posted earlier on this thread. I tested that quite a bit, so I am quite sure that the decade should be split logarithmically into 96 equal steps (sans rounding). In my testing, I compared results with the table published by several resistor manufacturers.

And the answers you get will not always be in the E96 series.

For example, 102 is the second in the E96 series; multiply by 1.024 and you get 104.448, which rounds to 104 which is not in the series.

Or, if you start with 100 and repeatedly multiply by 1.024, keeping the unrounded product as you go along (and *rounding* the running product at each step only to get the three digit number which should be a member of the E96 series), the first error occurs when the running product equals 136.1129468, which, rounded, is 136 and not 137 as it should be.

To get right results, you must use a multiplier of more than 4 digits.

Try this: go to

formatting link

and put the 96 values from the E96 series in a list, take the log of all the elements of the list (still in a list), make another list of the 95 first differences, add up the 95 first differences, divide the sum by 95, and take the antilog of that number. This will be the average ratio between elements of the E96 series. I get

1.02427190671, which is much closer to the 96th root of 10 than to the
97th root of 10.

By the way, there is a peculiarity (error?) in the E192 series. If you use the 192nd root of 10 to generate the series, the 186th member will be calculated as 919.478686, which would round to 919, but the official value is 920. Apparently the folks who originally did the numbers were a little off on that one.

I read in sci.electronics.design that Larry Brasfield wrote (in ) about 'Prefered resistor range', on Tue, 15 Mar 2005:

My understanding is that the values in these series don't include the first value of the next decade. So the E6 series has 7 values (which actually don't quite match the calculated values for reasons lost in the mists of time) : 1, 1.5, 2.2, 3.3, 4.7, 6.8 and 8.2, involving 6 multiplications by the *7th* root of ten; the 7th multiplication would give 10, which is the first value in the next decade.

However, I don't have the 'preferred numbers' standard, so I won't assert that I am correct.

Well, it depends on how your algorithm works, and I can't read PERL. The

96th root is 1.024275221... To four significant figures, the two roots are 1.024... So if you preserve only those four figures and calculate the values by successive multiplications, you will get the same answers whether you use the 96th root or the 97th root.

--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.

Now that you have the answer to your first question, don't you want to know why the 10% and 5% standard values don't result from a simple root-of-10 formula?

"John Woodgate" wrote in message news:uYUewiBywqNCFw+ snipped-for-privacy@jmwa.demon.co.uk...

I should maybe leave this at that point, but I am responding also to some points you make elsewhere in this thread.

You don't need to study my code to understand my point, which is that by splitting the decade logarithmically into 96 intervals, the correct 96 values are obtained. I conveyed this experience to underscore the idea that the reasoning I laid out should be examined carefully, as it is likely correct.

When I evaluate 1.024^96, I get 9.7453 on my HP32S. (And this agrees with another calculator I checked.) For the E96 series starting with 1, the 96th and last member is 9.76. So your method requires one more step (times 1.024) to reach the next decade. It produces 97 values per decade, (assuming we round off to 3 digits at each closest approach to whole powers of 10), whereas all the tables I've seen have only 96 values per decade.

Maybe there is some trick rule for rounding, dropping accumulated "erroneous" residue at special places, or other machinations, that will convert what would otherwise be 97 intervals into the 96 that are required to duplicate the standard values. I do not doubt your ability to devise such a rule. But I would hope you could see, if not acknowledge, the preferable simplicity of this rule: for (N = 0 to 95) standard_value[n] = round_to_3_digits( 10 ^ (N/96) )

Answering Mr. Phoull's request for "the formula that calculates the

1% 'preferred' range of resitors", absent any authoritive statement about how somebody long ago derived those tables, we have a choice: Use the above formula because it is easy and works; or complete the task of devising or elucidating your formula, which will be more complicated, amenable to no closed form solution, and unintuitive; or await or discover some other formula in the hope that it will be better. I should think it is an easy choice.

I read in sci.electronics.design that Allan Herriman wrote (in ) about 'Prefered resistor range', on Tue, 15 Mar 2005:

Thank you.

Yes, of course. I should have chosen E12, where such an error would have been much more obvious to me. The magnitude of the error for the E96 series is 0.000253241...

--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.

I can appreciate the humor here, abstractly. But after designing the Nth precision active filter, countless dividers, and other precise circuits, I got tired of table lookups. To lookup just one value is not overly hard, just tedious. You start with what you want, look at the table, and do a little simple arithmetic (often by eye) to decide which value is closest. Maybe you adjust that choice according to which way it went for some nearby resistor(s).

Now, if I want a 63.54k resistor, I enter: stdvals 1% 63.54k and get back 63400. This saves just a little time, so I cannot argue any clear superiority there.

Here is where an algorithmic approach really pays. I really want something closer, and I am willing to parallel two parts to get it. I enter: stdvals 1% 63.54k 2p and quickly get a useful result: Approximate 63540 as 1(1/66500 + 1/1.43e+06), yielding 63544.9 (ratio = 1.0001) This saves some real time. (I can remember when, during my stint as an engineering tech, I was given the task of doing approximately this same search for a short list of resistors. If not for the aid of an HP-35, it would have taken days, not the hours I had to spend on it.)

A common task in active RC filter design is to come up with capacitor pairs that deliver a close approximation to the values you really want. Ask: stdvals 5% 588p 2a and ye shall receive: Approximate 5.88e-10 with (5.6e-10 + 2.7e-11), yielding 5.87e-10 (ratio = 1.0017)

Any of you who have done this by hand know the lingering doubt that remains when you have not used an exhaustive search to find whatever answer you settled upon. Or you know just how tedious the exhaustive search is. Or both.

I guess the natural extension of Rich's joke is: Who needs calculators or computers? I've got tables of values and logarithms, a slide rule, and my trusty pencil and pad. Valves forever!

I read in sci.electronics.design that The Phantom wrote (in ) about 'Prefered resistor range', on Tue, 15 Mar 2005:

They obviously looked at rounding: 919.478686..-> 919.47869 -> 919.4787

-> 919.479 -> 919.48 -> 919.5 - > 920.

This is a well-known effect of rounding and can be combated, but not necessarily eliminated (as in this case), by 'casting to the odd'. This means that you round down a number ending in 5 if the resulting final digit would be odd if you rounded up.

--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.

If you need 63.54K and you have the complete range of 1% tolerance resistors available you have a problem that no elementary, or sophistacated, calculator is going to solve

You appear to have assumed that the resistors to be used would be 1% tolerance. It happens that the 0.1% tolerance parts come in the same values, (or more, for more money), so there is a use for calculations such as the above example.

This script doesn't work as advertised using perl under cygwin (suprise). What version of perl is it targeted towards? If you send me some sample output, I'll take a look. It's probably something simple.

version of perl is it targeted towards? If you send

Thanks for the report and offer. While I mentioned the ActiveState distro, I am actually using the cygwin version here. To wit (with extranea cut): > set | findstr .pl= .pl=perl > perl -v This is perl, v5.8.6 built for cygwin-thread-multi-64int

What version are you using? I will be happy to find and fix the problem if I can replicate it (or if you want to send me its blurp via email). And if your difficulty reflects a shortcoming in the admittedly sparse "help", I will be more than happy to fix that. I wrote that script for my own purposes, so it probably has plenty of room for improvement in a wider context.

Here is a simple session that "should" replicate, with a newline inserted after certain commas for legibility and the prompt reduced: =========== begin near screen scrape ===============

Usage: stdvals tolerance or stdvals tolerance value [2a|2p|2r] or stdvals -n decsplit Standard tolerances are: 1% 10% 20% 5% 50% Standard decade splits are: 12 24 3 6 96

version of perl is it targeted towards? If you send

I'm using 5.8.5. However, I figured it out. You keep typing '1%' in your examples. The program, however, seems to want '1' as opposed to '1%', and adds on the % internally. If you type in the percent sign, it fails, and prints the usage.

I wonder if you posted a version of the script that is a different version than the one you are running?

examples. The program, however, seems to want '1' as

sign, it fails, and prints the usage.

That is because the shell you are using has been swallowed something. Usage is blurted for any unrecognized arguments.

than the one you are running?

Not a bad supposition. The problem is that I am using a command-line shell (4NT) that is nowhere near as brain-dead as the cmd.exe that ships with Windows. I think, given that most people on that platform put up with that shell, (which I remember mainly like bad dream), I'll revise my script to not use the '%' at all and repost. It was a PITA to type anyway. I'm reviewing the help for sufficiency and adding a few comments so nobody thinks I am a complete bozo, (at least not for that reason! ;-)

If anybody ever sees a comprehensive, complete and accurate explanation of the quoting rules for that miserable shell, I would like to see them.

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.