Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Optimising a 3 value problem (well 2 really)

Parent

Optimising a 3 value problem (well 2 really)

+4
−0

I have tried to find a way to optimise value selections so a range of results based on 3 values will be as evenly spaced as possible as close as possible to a geometric series.

I have a thought experiment that requires the selection of 3 values. These values must have a sum of 100 (not important as final result can be scaled as required but it keeps the numbers civilised) The values can be combines by adding them or by combining the reciprocal or their reciprocals or even a combination of reciprocal and sum. They are all three different in value as experimentation has shown that the distribution of results gets worse if the numbers are the same.

My goal would be to figure out a way to optimise the selection of the numbers such that the results have the lowest error from a geometric progression.

Is there a mathematical result that will minimise the error or do I just keep messing around with two of the numbers (the third is constrained by the chosen full sum)?

Can I use Excel to goal seek on the R value of a trend line on a plot?

This is the list of combinations I have found, the result size sequence changes depending on the three values so only the first and last four are always in the same place.

A||B||C, A||B, A||C, A||(B+C), A, B||C, (A+C)||B, (A+B)||C, B, A+B||C, A||C+B, A+B, C, A||B+C, A+C, B+C, A+B+C

Backstory. This relates to electrical technology and consumer appliance repair and repair technician stock management. I had occasion to look at a list of motor start or run capacitors for appliances on a web store listing. I was rather taken aback by the large selection that was available. They had 74 types with 34 unique electrical values of capacitance. The capacitance spanned 2 decades ranging from 1uF to 100uF.

I though what if a house call technician could stock just two multi section capacitors to cover the full range and configure them on site, so I started to think how many ways can we arrange three capacitor sections in series or parallel and how many evenly spaced values can I find that would allow selection of close fit to desired value with minimal error. Turns out there are 17 combinations I came up with and if one hoped to space them perfectly evenly they should be 1.145 apart in value to fit the 17 possible values in the one decade of capacitance. The idea that a single capacitor that contains 3 elements could be wired up in such combinations to give any value between 1.145uF and 10uF and another unit that would offer values from 11.45uf to 100uf. Certain restrictions came up but I found a close fit with the values 21.739uF, 34.783uF, 43.478uF. They make up 100uF in parallel and 10.230uF in series so not bad. However they do not stay within my +-10% error bars for the geometric sequence that would span the decade.

My go to mathematical modelling software is Excel but I could try other tools as well, might have to learn VBA to automate testing and error calculations.

I will insert a random plot of some of the values I was testing. A surprisingly good fit is 22.22uF, 33.33uF and 44.44uF

Distribution of results between ten percent error bounds of geometric sequence

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+2
−0

This is the list of combinations I have found, the result size sequence changes depending on the three values so only the first and last four are always in the same place.

A||B||C, A||B, A||C, A||(B+C), A, B||C, (A+C)||B, (A+B)||C, B, A+B||C, A||C+B, A+B, C, A||B+C, A+C, B+C, A+B+C

I think it's only the first three and last three. This is the Hasse diagram which I obtain: Hasse diagram - sorry, I'm not going to try describing it in full

By considering the contours of equalities between incomparable terms in the Hasse diagram, I obtain this as a "phase diagram" of the possible total orders:

Triangle split by parabolae

I count 30 possible total orders.

Can I use Excel to goal seek on the R value of a trend line on a plot?

If this is a question about Excel, I don't know and this isn't the right place to ask. But treating it as a mathematical question about the nature of the goal function within each of the areas on the phase diagram, I think (although I haven't attempted to prove) that it should be smooth enough that hill climbing would work, so it seems like a viable strategy to pick one point away from the edges of each area and goal seek from there.

There is one additional point to raise about the goal function, which is that you may have a fencepost error. Do you want 17 steps per decade or 17 values and 16 steps?

Experimenting with Plotly and some simpler cost functions (although I think least squares error from the target line is closer to what you actually want than the "R value"), there doesn't seem to be a parameter set which fits within your desired 10% error bound. The best results seem to be $A \approx 27 \pm 0.1$, $B \approx 33.5 \pm 0.5$

Code

Graph for least squares (L2 norm applied to errors):

Nested roughly ellipses

Graph for total error (L1 norm):

Nested wedge-like shapes

With a somewhat different goal, if we just aim for even spacing and forget about trying to fit a decade, $A \approx 16.1$, $B \approx 29.6$ is quite good.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

Works for me (1 comment)
Firstly, WOW! Thank you, kind of exactly the type of answer I was hoping for. Never having heard o... (2 comments)
Firstly, WOW! Thank you, kind of exactly the type of answer I was hoping for. Never having heard o...
KalleMP‭ wrote over 2 years ago

Firstly, WOW! Thank you, kind of exactly the type of answer I was hoping for. Never having heard of a Hasse diagram it looks to be perfectly suited to describe the combinations. Your phase diagram shows the massive complexity of finding a trivial solution that was crushing my brain. Both your suggested solutions oddly enough appear in the larger areas and are very close to my hand selected choices included in my graph. I struggled with the fencepost (intuitively descriptive term) dilemma a lot, and was not sure if there was a minimum or maximum slope that I could achieve, the original two decade component range led me to a decade but I noticed that a greater slope could be achieved in exchange for larger spacing but had no way to prove that the spacing would improve. Your second values have a ratio of 1.163 as opposed to the decade 'goal' of 1.145 but I can not see a limit except the spacing will degenerate again at some point. How did you select for "even spacing"? Superb Answer.

Peter Taylor‭ wrote over 2 years ago

I tried two cost functions for "even spacing". If the gap between two consecutive values is the difference of their logarithms, the first cost function was the difference between the largest gap and the smallest gap; and the second cost function was the variance of all the gaps. I can't tell you offhand which one gave the values mentioned in the last paragraph of the answer, but from memory I think that their optimal parameters were quite close to each other anyway.