Does this quesion have a solution?

WBahn

Joined Mar 31, 2012
32,844
The reason I worked in percent error rather than absolute error was because that is the normal way to do these. That's because for a voltage that is much different than another the absolute error shows almost nothing while the percent error shows the relative errors.
But in this case it isn't the percent error that matters, because the goal was to pick a set of integer resistor values that results in the three voltages indicated on the original diagram, which means that they match after rounding to two decimal places, or in other words that, that the calculated values are within +/- 5 mV of the annotated values, regardless of what fractional error that ends up being.

If you want to work with percent error, then you need to set different limits for each value.

The value for V1 has to be within 0.0842%, the value for V2 has to be within 0.1548%, and the value for V3 has to be within 0.2016%.

It's just much easier to say that each voltage has to be within 5 mV and get on with the analysis.
 

MrAl

Joined Jun 17, 2014
13,704
It's the value given in post #1 where it says: [R0+R1+R2+R3]= 29.23

In post #9 the question was asked: "Can I assume that the statement “[R0+R1+R2+R3]=29.23Ω” refers to the serial/parallel combination of those resistors and not their simple sum?" and after discussion it's clear that it refers to the series/parallel connection.

The expressions given in the image at the end of post #71 give (for any feasible value of R0) the values of R1, R2, and R3 that will give the exact correct values of 2.48 V, 3.23 V, and 29.23 ohms when these tests are performed:

5.94*R1/(R1+R0)=2.48 V
5.94*R3/(R3+R2)=3.23 V
(R1+R0) in parallel with (R2+R3) = 29.23 ohms
Hello,

Still not sure why you are repeating 29.23 Ohms when that is not the correct value.
It seems obvious to me that the OP made a simple mistake in post #1, and this is also a bit obvious because of the way he stated the 'parallel' resistances as all in series (summed). That's two mistakes in the first post. Not the end of the world, but has to be a consideration.

If we wanted to find the solution I would believe we want to use the best possible value. If you want to use another value that's find, but then why not used 29.12345 or 129.54321. If he stated 12345.54321 Ohms instead, should we be using that value ? :)

I am using the best possible value because that is the actual solution for the total required parallel resistance. I do not see how we could get another value because we won't get 5.94 volts exactly at the first junction after the 20 Ohm resistor.
 

MrAl

Joined Jun 17, 2014
13,704
But in this case it isn't the percent error that matters, because the goal was to pick a set of integer resistor values that results in the three voltages indicated on the original diagram, which means that they match after rounding to two decimal places, or in other words that, that the calculated values are within +/- 5 mV of the annotated values, regardless of what fractional error that ends up being.

If you want to work with percent error, then you need to set different limits for each value.

The value for V1 has to be within 0.0842%, the value for V2 has to be within 0.1548%, and the value for V3 has to be within 0.2016%.

It's just much easier to say that each voltage has to be within 5 mV and get on with the analysis.
Hi,

Well if you look at the reasoning behind that, it's usually what is done because of the significance on each measurement. If we were to measure each voltage with a 2 percent meter we could get measurements that could be 1 percent off, we would not get measurements like 100.01 and 1.01 because that would require a more expensive meter and would not tell us much more anyway. That's why the more typical method is to use percent error.

It's perfectly fine if you want to use absolute error, I am not saying it is a complete mistake, but it is also a bit interesting that we both got the same results that we both consider the best approximations.

BTW it's not that much different or difficult to calculate the percent error other than the absolute error for voltages all positive.
Absolute error: AErr=abs(Vmeas-Vtarget), if AErr>0.02 then return 0 else return 1.
Fractional percent error: FPErr=abs(Vmeas-Vtarget)/Vtarget, if FPErr>0.01 then return 0 else return 1.

The situation gets ever more dire when we look at higher voltage ranges. For example, 1000v vs 1v.
If we look for an error of 0.01v in that 1v which could be normal, it would be kind of strange to look for an error of 0.01v in that 1000v because if it was 1000.02v it would fail while that is not such a bad result while that 1v is actually 1.01 volts and would pass. In other words, i do not think we would want it to fail just because that 1000 volts is 0.02 volts off.
 

MrAl

Joined Jun 17, 2014
13,704
hi Al,
As stated, I used WB post #47 for that last sim. Post #70.

This image is my original Sim circuit.

I calculated the 203mA division into the two resistor branches based on the ratio of the given Vb and Vc Node voltages.
eg: 203mA( 3.23/(3.23+2.48)) ....

Try that, see what you get.

E
View attachment 307941
Hi Eric,

Oh ok thanks. Yes those get very close, not bad at all.
 

WBahn

Joined Mar 31, 2012
32,844
Hi,

Well if you look at the reasoning behind that, it's usually what is done because of the significance on each measurement. If we were to measure each voltage with a 2 percent meter we could get measurements that could be 1 percent off, we would not get measurements like 100.01 and 1.01 because that would require a more expensive meter and would not tell us much more anyway. That's why the more typical method is to use percent error.

It's perfectly fine if you want to use absolute error, I am not saying it is a complete mistake, but it is also a bit interesting that we both got the same results that we both consider the best approximations.

BTW it's not that much different or difficult to calculate the percent error other than the absolute error for voltages all positive.
Absolute error: AErr=abs(Vmeas-Vtarget), if AErr>0.02 then return 0 else return 1.
Fractional percent error: FPErr=abs(Vmeas-Vtarget)/Vtarget, if FPErr>0.01 then return 0 else return 1.

The situation gets ever more dire when we look at higher voltage ranges. For example, 1000v vs 1v.
If we look for an error of 0.01v in that 1v which could be normal, it would be kind of strange to look for an error of 0.01v in that 1000v because if it was 1000.02v it would fail while that is not such a bad result while that 1v is actually 1.01 volts and would pass. In other words, i do not think we would want it to fail just because that 1000 volts is 0.02 volts off.
It doesn't matter what is or is not usually done, or what makes sense in some other hypothetical situation. What matters is what makes sense in terms of the stated goal for the problem actually being solved. The stated goal for most of us that have offered specific resistor values is to match the constraint voltages as given on the diagram when the values are rounded to the same resolution as the values given.
 

MrAl

Joined Jun 17, 2014
13,704
It doesn't matter what is or is not usually done, or what makes sense in some other hypothetical situation. What matters is what makes sense in terms of the stated goal for the problem actually being solved. The stated goal for most of us that have offered specific resistor values is to match the constraint voltages as given on the diagram when the values are rounded to the same resolution as the values given.
Hi again and thanks again for the reply.

Yes, that's what I did, I just used a different fit criterion.
I tried every positive whole value from R0=18 Ohms up to 1000Megohms.
To make it simpler, I rounded UP the other three resistors values resulting from R0. When I rounded down I got another result but it was slightly less accurate than the set you and I both got. Those however were rounding ALL three UP or ALL three DOWN.
What I did not do yet was try to round some of the three DOWN and some of the three UP, and see if a better result comes out of it. I think you suggested this already.
I would be happy to do it using both fit criteria (percent error and absolute error) no problem.
Please note I have nothing against using absolute error.

[LATER]
Ok I tried rounding the three resistors up and down in all possible ways and the solution remains the same, except that I found that it does not matter if we round R1 up or down we get the same result. That's because the value of R1 before rounding is close to 75 anyway, like 75.2 or something, so rounding up or down keeps that one at 75 Ohms.
The other two are different though because they are something like 15.9 and 18.9 so they round up and down to different values, and only rounding those two up produces the best solution.
The search space was R0=18 Ohms to 100 Megohms but I do not see anything changing with higher values.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,844
Ok I tried rounding the three resistors up and down in all possible ways and the solution remains the same, except that I found that it does not matter if we round R1 up or down we get the same result. That's because the value of R1 before rounding is close to 75 anyway, like 75.2 or something, so rounding up or down keeps that one at 75 Ohms.
The other two are different though because they are something like 15.9 and 18.9 so they round up and down to different values, and only rounding those two up produces the best solution.
The search space was R0=18 Ohms to 100 Megohms but I do not see anything changing with higher values.
How does rounding 75.2 up result in 75 Ω?
 

MrAl

Joined Jun 17, 2014
13,704
How does rounding 75.2 up result in 75 Ω?
Hi,

Rounding up is:
R=floor(R+0.5)

while rounding down is:
R=floor(R)

I do not think there would be any good reason for doing say:
R=floor(75.2+1)

because that would result in 76 which would be too far from 75.2, and besides 76 or close to it would come up naturally in the normal process of the search if in fact there was a solution that was close and had 76 as a true value.

There is one more type of rounding but I do not think it applies here, although it could.
That would be to scatter the rounding randomly. This is sometimes done in binary. The least significant bit is flipped for every other calculation. That was done in the past because of the distribution of errors not being spread evenly over multiple math operations.
This would mean that if we did two calculations with 75.0, or 75.1, or 75.2, up to 75.9, the first calculation would result in 75 and the second calculation would result in 76, even though both starting numbers were the same (like 75.2). That's only because we are working with whole numbers though. In the binary version, the least significant bit could represent a very small value like 1e-16 or something. I think it makes more sense then.

I was able to run R0 from 18 Ohms to 1 Gigohm again but using the rounding up and down for each resistor method. Same result.

Now that I think about it again it seems there is no good reason for forcing a value to round down, just plain rounding does the trick.
For example, if we got an exact value of 85.9 it would not make sense to try 85 because it would be too far from 85.9, so the only good try is to round to 86, which would be rounding up, or as some would call it, just rounding to the nearest whole number. That's about the same as trying to push 85.1 all the way to 86, as it's not going to be a very good choice while 85 will be very good.
Perhaps this is why the solution came out with either all rounded up or that one resistor R1 going down to the nearest whole while the other two rounded up to the nearest whole.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,844
Rounding up is:
R=floor(R+0.5)
No, that's just regular rounding.

Rounding x up is ceiling(x), rounding x down is floor(x). Normal rounding (ignoring bias) is round(x), which is the same as floor(x + 0.5). This is how normal rounding is done when you want to round a floating point value to the nearest integer value via casting.

I do not think there would be any good reason for doing say:
R=floor(75.2+1)
And this is not rounding up, either, as this would result in 75 being "rounded" to 76.

But there are plenty of good reasons to round 75.2 to 76. If the number of barrels you need to hold something comes out to be 75.2 barrels, you need to get 76 barrels.

Now that I think about it again it seems there is no good reason for forcing a value to round down, just plain rounding does the trick.
Which is why floor(x+0.5) is just normal rounding, and not rounding up.

For example, if we got an exact value of 85.9 it would not make sense to try 85 because it would be too far from 85.9, so the only good try is to round to 86, which would be rounding up, or as some would call it, just rounding to the nearest whole number. That's about the same as trying to push 85.1 all the way to 86, as it's not going to be a very good choice while 85 will be very good.
Perhaps this is why the solution came out with either all rounded up or that one resistor R1 going down to the nearest whole while the other two rounded up to the nearest whole.
But what if the nominal values came out to be (just making up values), 19.47 Ω, 23.36 Ω, and 57.17 Ω. Taken individually, you would round each of these down. But that results in the values for all three being smaller than ideal, which is going to increase the overall current, which is going to drop V1 (the voltage after the 20 Ω resistor). Realizing this, it is possible (even likely) that a better overall solution will be to round two of the values down, but to round the remaining value up. In essence, you are pushing some of the error from rounding the first two values onto the third.

Another way of thinking of this is that we are setting one resistance to an integer value and then figuring out the nominal values for the other three. Instead of just accepting those three values and rounding them independently, we could pick one of them (perhaps randomly, or perhaps whichever one was closest to an integer, or perhaps the one that would suffer the smallest relative error by being rounded to an integer) and now we have two integer values and we recompute the nominal resistances for the remaining two. It would not be surprising to see the new values shift a bit and possibly by enough to result in a different rounding decision.

As an example, let's say that these three resistance are in series and the total series resistance is supposed to be 100 Ω. Other constraints (such as given intermediate node voltages) result in the three voltages given above. If these are all rounded normally, the total series resistance is 99 Ω. But if one of them is rounded up, we hit the target total series resistance exactly. But which one should be rounded up? The "obvious" candidate is the first one, since it was already pretty close to being rounded up normally anyway. Maybe that's the right decision. But note that the error in rounding it up is about 2.4%, but the error in rounding the last one up is less than 1.5%. But even these considerations don't yield an unambiguous answer, because that is only determined by the criteria of what we are trying to achieve.
 

MrAl

Joined Jun 17, 2014
13,704
No, that's just regular rounding.
Yes, I mentioned that some people just call this regular rounding. In fact, most people do.
I really just needed another name to distinguish it from rounding down.

Rounding x up is ceiling(x), rounding x down is floor(x). Normal rounding (ignoring bias) is round(x), which is the same as floor(x + 0.5). This is how normal rounding is done when you want to round a floating point value to the nearest integer value via casting.
"R=floor(75.2+1)"
And this is not rounding up, either, as this would result in 75 being "rounded" to 76.
Isn't that the same as R=ceil(R) which you call rounding up?
76=floor(75.2+1)
76=ceil(75.2)

But there are plenty of good reasons to round 75.2 to 76. If the number of barrels you need to hold something comes out to be 75.2 barrels, you need to get 76 barrels.
I meant how it pertains to this problem, not in general. In this problem if 76 was part of a solution it would come out later possibly to 76.2 and be rounded down to 76, or to 75.8 and be rounded up to 76. If the next computed value was 79.2 the number 76 would never come up.


Which is why floor(x+0.5) is just normal rounding, and not rounding up.
Yes I just called it that for now, and now I've provided the definitions. We can call it just round(x) no problem.


But what if the nominal values came out to be (just making up values), 19.47 Ω, 23.36 Ω, and 57.17 Ω. Taken individually, you would round each of these down. But that results in the values for all three being smaller than ideal, which is going to increase the overall current, which is going to drop V1 (the voltage after the 20 Ω resistor). Realizing this, it is possible (even likely) that a better overall solution will be to round two of the values down, but to round the remaining value up. In essence, you are pushing some of the error from rounding the first two values onto the third.
Yes all three would be smaller than ideal, but because 19.47 is closer to 19 it is more likely to be 19 than 20. Ditto with the other two.
In other words, 19.47 is closer to 19 than it is to 20, making it a better choice. If 20 does provide a good result it would come out later with a different R0 most likely, so we might see 20.1 to 20.9 come up with the next search set for example.
There's no problem really as I could change R=floor(R+0.5) to R=ceil(R) and see what happens. I'll try that up to maybe 10 million.

Another way of thinking of this is that we are setting one resistance to an integer value and then figuring out the nominal values for the other three. Instead of just accepting those three values and rounding them independently, we could pick one of them (perhaps randomly, or perhaps whichever one was closest to an integer, or perhaps the one that would suffer the smallest relative error by being rounded to an integer) and now we have two integer values and we recompute the nominal resistances for the remaining two. It would not be surprising to see the new values shift a bit and possibly by enough to result in a different rounding decision.

As an example, let's say that these three resistance are in series and the total series resistance is supposed to be 100 Ω. Other constraints (such as given intermediate node voltages) result in the three voltages given above. If these are all rounded normally, the total series resistance is 99 Ω. But if one of them is rounded up, we hit the target total series resistance exactly. But which one should be rounded up? The "obvious" candidate is the first one, since it was already pretty close to being rounded up normally anyway. Maybe that's the right decision. But note that the error in rounding it up is about 2.4%, but the error in rounding the last one up is less than 1.5%. But even these considerations don't yield an unambiguous answer, because that is only determined by the criteria of what we are trying to achieve.
Yes I guess there are other things we could try.
Maybe vary each one by 1 either way, after rounding normally.
R=floor(R+0.5)
Ra=R-1
Rb=R+1
I have a feeling this won't help though but not impossible to try. That's because I do not think that values that are just 1 Ohm from a near solution value do not make the solution better ever.
There also seems to be a max R0 value that once exceeded will never provide a better solution.
I have not tried to calculate the truth of either of these guesses.


I also thought about finding the best solution based on 1 percent standard resistance values. That would be highly practical as I read that some readers wanted to find the most practical solution. We could also go to 2 percent standard values, and 5 percent standard values.
We should be able to pick up one more digit of precision.[/quote]
 
Last edited:

WBahn

Joined Mar 31, 2012
32,844
"R=floor(75.2+1)"
And this is not rounding up, either, as this would result in 75 being "rounded" to 76.
Isn't that the same as R=ceil(R) which you call rounding up?
76=floor(75.2+1)
76=ceil(75.2)
You need to read what I wrote -- and what you quoted. I explained why these are not the same.

ceil(75) = 75
floor(75+1) = 76

They are NOT the same!

Yes all three would be smaller than ideal, but because 19.47 is closer to 19 it is more likely to be 19 than 20. Ditto with the other two.
In other words, 19.47 is closer to 19 than it is to 20, making it a better choice. If 20 does provide a good result it would come out later with a different R0 most likely.
Again, go back and read what I wrote carefully. You can't round the values independently because rounding any of them affects what the nominal values of the others should be.

And there's no reason to think that rounding the other direction would somehow come out later using a different value for R0. None whatsoever.
 

MrAl

Joined Jun 17, 2014
13,704
You need to read what I wrote -- and what you quoted. I explained why these are not the same.

ceil(75) = 75
floor(75+1) = 76

They are NOT the same!



Again, go back and read what I wrote carefully. You can't round the values independently because rounding any of them affects what the nominal values of the others should be.

And there's no reason to think that rounding the other direction would somehow come out later using a different value for R0. None whatsoever.
Hi,

Oh yes that is correct about ceil(x). That one value of 75 would produce 75, while 75.000001 would produce 76.

As to there being no reason to think that rounding the other direction would somehow come out later using a different value for R0, that's not exactly what I said or at least meant.
In fact, I am saying the opposite, with a guess, but overall not saying that in that way.

What I am saying first is that *if* a different value for R0 *does* come up with a value that is just a small amount away from the previous value for that resistor, then that value will come up naturally. The reason for this is because R0 controls the other values, and so there can only be some values that come out of R0 and some other values that come out of the next R0 which is the previous R0 plus 1.
What I am guessing secondly is that there will never be two values like that that are close together and where both cases cause a good solution, or at least not the best solution.
These two tell me that it is very likely that R=floor(R+0.5) is the best choice for rounding. This is actually what came out of the search also except for that one value of R1 which using floor() or round() produces the same integer for that one resistor and that turns out to be the best solution.
The way it looks is if we had values 1, 2.3, 3.8, and 4.4, then the closest would be 1, 2, 4, and 4. I would not expect 1, 2, 4, and 5 to be better, nor would I expect to see 1, 3, 4, and 4 be better either.
I do not think this would be too hard to test however if you'd like to see that. I think all we have to do is force the variation to go 1 Ohm higher than the rounded value, and 1 Ohm lower than the rounded value, and see if either of those produce a better result.
 

ci139

Joined Jul 11, 2016
1,989
Is it possible to solve for any resistor values or all four?
1-st you know the current through 20Ω resistor, say it's \(R_4\) that has a \(V_P0\) at it's more negative terminal

You'd know the values of the remaining resistors if one of them is known in advance . . . if not - there will be multiple solutions

it's because right now you do not know the ratio of currents through the nodes \(R_0+R_1\) and \(R_2+R_3\)

!!! HOWEVER - the situation will change IF . . . this actually is a real world circuit , where you can swap the resistors :

  • \(R_0+R_1\) in parallel with \(R_2+R_3\)
  • \(R_0+R_2\) in parallel with \(R_1+R_3\)
  • \(R_0+R_3\) in parallel with \(R_1+R_2\)
  • or even
  • \(R_0+R_1+R2\) in parallel with \(R_3\)
  • . . .
  • \(R_i\) in parallel with \(R_4\) where \(i \in \left\{0\ ...\ 3\right\}\)
____________
what you can have now is
R-set.png\( \LARGE \frac1{\frac1{R_0+R_1}+\frac1{R_2+R_3}}=\frac{V_0}{V_S}·\frac{V_S}{\left({\frac{V_s-V_0}{R_4}}\right)}\\ \)
\( \large \frac{R_1}{R_0+R_1}=\frac{V_1}{V_0}\\ \large V_0R_1=V_1R_0+V_1R_1\\ \large R_1=R_0\frac1{\frac{V_0}{V_1}-1}=R_0S_1 \)

\( \large \frac{R_3}{R_2+R_3}=\frac{V_2}{V_0}\\ \large V_0R_3=V_2R_2+V_2R_3\\ \large R_3=R_2\frac1{\frac{V_0}{V_2}-1}=R_2S_2 \)
\( \LARGE \frac1{ \frac1{ R_0\left({1+S_1}\right)}+\frac1{R_2\left({1+S_2}\right)}}=R_4\frac1{\frac{V_S}{V_0}-1}=R_4S_0 \)
_________
Which means if you specify the \(R_0\) it sets the values for\(R_1\) . . . and for the \(R_2\) and \(R_3\)
 

MrAl

Joined Jun 17, 2014
13,704
Hello again,

I tried a different way of rounding and came up with the same result for the best integer solution:
{105,75,16,19}

What I did was rounded down the ideal values, then tried three values:
1. That value.
2. That value + 1.
3. That value - 1.
That gives a total of 27 different values for each ideal value.
This was tested over a space of R0=18 Ohms to 1 Gigohms.

So I guess this concludes the search for the best positive whole values for the resistors.

BTW, Happy Thanksgiving to everyone who celebrates that.
 
Top