Author Topic: [Broken brain] Help with simple graphing/algebra problem  (Read 3565 times)

0 Members and 1 Guest are viewing this topic.

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 5053
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
[Broken brain] Help with simple graphing/algebra problem
« on: August 05, 2026, 12:21:56 am »
I'm almost ashamed to post this here.

I'm unable to solve a really simple math problem, one that I could probably have done some decades ago.
However, in my defense, it's been a long time since I took algebra, or even used it much.

So: I'm trying to basically do some linear interpolation extrapolation to determine an unknown value.
Graph shows it all:



The assumption here is that the function is linear. I know two values of y (frequency) corresponding to values of x (resistance).

(Don't even ask what the application is here: it doesn't matter. I'm just trying to figure this out as a math problem.)

I'm trying to determine x at point C. Can't figure out how to do that.

What's the formula I should be using? Gotta be dead simple.

I know what the slope of the line is from the two known points: -9/8. I know there's that slope-intercept formula, y=mx+b, but I have no idea what the intercept is. Seems to me I shouldn't even need to know that to solve this.

Help!

And please, let's limit this to just this simple math problem, 'k? No second- or third-order stuff. I just need to be able to wrap my head around how to solve this simple puzzle.

Thanks in advance.
« Last Edit: August 05, 2026, 08:40:29 am by Analog Kid »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 4236
  • Country: us
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #1 on: August 05, 2026, 01:17:16 am »
You have the following (x,y) pairs: (39, 128) and (47, 119).

Assume y = m*x+b.

m = (y1-y2)/(x1-x2) = (128-119)/(39-47) = -1.125

Then solve for b using one of the pairs, e.g.:

128 = m*39+b => 128 = (-1.125)*39+b

or b = 128 - (-1.125)*39 = 171.875

So y = -1.125*x + 171.875.

To solve for the x value when y = 113...

113 = -1.125*x + 171.875 => x = (113-171.875)/(-1.125) = 52.33

 
The following users thanked this post: Smokey, Analog Kid

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 5053
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #2 on: August 05, 2026, 01:47:44 am »
Thank you.

Shoulda gone with y=mx+b, but I thought finding the intercept would be difficult.

It isn't.
 

Offline gbaddeley

  • Frequent Contributor
  • **
  • Posts: 296
  • Country: au
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #3 on: August 05, 2026, 04:08:11 am »
Can also be solved using similar triangles. Let point D be at 39,119. Point E at 39,113.
Angles ABD and ACE are the same. Tangent ratios are AD/BD = AE/CE. 9/8=15/CE. Therefore CE=13.333. Add x value 39 to give same answer as above 52.333, however it doesn’t derive the linear equation.
« Last Edit: August 05, 2026, 04:19:01 am by gbaddeley »
Glenn
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 2539
  • Country: pl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #4 on: August 05, 2026, 04:41:19 am »
Don’t worry, happens to everybody.

First a method that is only good for quick estimation, but also simple:




As for another arithmetic approach, this may be seen as parallel vectors:



Using (39, 128) as the reference:

AB = (8, -9)
AC = (x, -15)

Since AC is a multiple of AB, their coördinates are also proportional:

x = 8 · (-15 / -9) ≈ 13.33

Moving back to original positions: x + 39 = 52.33
Why 📎 | We live in times when half of people have IQ below 100.
 
The following users thanked this post: Analog Kid

Offline IanB

  • Super Contributor
  • ***
  • Posts: 13125
  • Country: us
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #5 on: August 05, 2026, 05:36:23 am »
What's the formula I should be using? Gotta be dead simple.

It is, it is the linear interpolation formula.

We know that slope equals rise over run, so we can write that down:
$$\textrm{slope} = \frac{y_B - y_A}{x_B - x_A} = \frac{y_C - y_A}{x_C - x_A}$$
From here you can just plug in the numbers you know and rearrange to find the value of \(x_C\) that you don't know:
$$x_C = x_A + \frac{y_C - y_A}{y_B - y_A} (x_B - x_A)$$
$$x_C = 39 + \frac{113-128}{119-128} (47-39)=52.33$$
There is no need to find the actual slope or intercept of the line.
« Last Edit: August 05, 2026, 05:55:56 pm by IanB »
 

Offline gbaddeley

  • Frequent Contributor
  • **
  • Posts: 296
  • Country: au
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #6 on: August 05, 2026, 06:46:17 am »
What type of timer, filter or oscillator is this for?  Normally F is proportional to 1/R. You have F as a negative linear proportion to R.
Glenn
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: au
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #7 on: August 05, 2026, 07:43:04 am »
I'm almost ashamed to post this here.

So: I'm trying to basically do some linear interpolation to determine an unknown value.
Graph shows it all:

Thanks in advance.
This is the kind of problem that I’m too lazy to do on paper, and not worth the trouble of loading up MATLAB. This is why I keep a graphical calculator TI-83 nearby.

My graphical calculator is almost as indispensable as my soldering iron.

I should note that the latest generation of graphical calculators go waayyy overboard with programming features, I don’t like these.
 

Offline nonius_

  • Regular Contributor
  • *
  • Posts: 177
  • Country: nl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #8 on: August 05, 2026, 08:15:07 am »
I know I'm a bit late to the party, but there's also

https://interpolationcalculator.com

2869248-0

Quote
So: I'm trying to basically do some linear interpolation to determine an unknown value.

'Akshually', it's extrapolation :)

Quote
This is the kind of problem that I’m too lazy to do on paper, and not worth the trouble of loading up MATLAB. This is why I keep a graphical calculator TI-83 nearby.

I've always disliked graphical methods for solving problems as being too cumbersome, taking too much effort and carefulness. The algebraic method on a piece of paper is my go-to method. But it is BECAUSE I'm lazy that I don't use the solvers on the HP48GX or HP32Sii.... those methods require too much effort. Would have to get out the manual and figure out how it works again.

There are websites with calculators (see e.g. above) that can solve these simple linear problems much easier and quicker than I can relearn how to use the HP48.... And if a search for a website with calculator failed, I'd probably fire up Derive on the old DOS....

But y=ax+b and a piece of paper is simplest. Two equations with two unknowns. Don't have to resort to matrices to solve that one :)

Many ways to skin a cat.

But yeah, I've got the same problem as OP - so much of my math-knowledge has been sitting unused that sometimes, amazingly simple problems take much more effort than I'd like. Use it or lose it!
« Last Edit: August 05, 2026, 08:19:35 am by nonius_ »
set SCE to AUX
 

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1351
  • Country: pl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #9 on: August 05, 2026, 08:32:24 am »
Graph shows it all:

I would calculate it looking just at graph as follows (if you wonder why this way - I don't like negative values):
(x-39)/15=8/9
x=39+8*15/9=39+13.(3)=52.(3).

When being in secondary school I decided to add to my radio-receiver (it was probably third its version and first superheterodyne) the alarm for green night at the hiking camp. The alarm was to be triggered by breaking a 0.05mm diameter wire. I noticed that for one resistor my device will not work for R=0 and for R=inf. but in between there exists one R value allowing for max wire length. I didn't needed the wire be 30km but I was interested how to find the optimum R value. I was only able to find an approximation by successive attempts.
When I was at that stage and went to school we just had introduced derivatives what I used the same day afternoon to find my optimum R value.
« Last Edit: August 05, 2026, 08:38:49 am by PGPG »
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 2539
  • Country: pl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #10 on: August 05, 2026, 03:00:21 pm »
Don’t feel stupid about forgetting simple things you don’t often use. A funny story. In college we were faced with some problem that involved calculating area of a triangle, half of a square with known side. This kind:

◺

Trivial, right? After staring blankly at the triangle for a sec, both the person at the whiteboard and a few others (me included) meticulously used integral to do so.
Why 📎 | We live in times when half of people have IQ below 100.
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2626
  • Country: is
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #11 on: August 05, 2026, 11:26:30 pm »
This is my strange way of arriving at the answer. The distance from 119 to 128 is 9. The distance from 113 to 119 is 6. 6/9 = .666  The distance from 39 to 47 is 8. 8 X .666 = 5.328  Add that to 47 and get 52.328 ohms. I don't even know exactly why I did it that way but it looks correct.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 13125
  • Country: us
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #12 on: August 06, 2026, 12:22:22 am »
This is my strange way of arriving at the answer. The distance from 119 to 128 is 9. The distance from 113 to 119 is 6. 6/9 = .666  The distance from 39 to 47 is 8. 8 X .666 = 5.328  Add that to 47 and get 52.328 ohms. I don't even know exactly why I did it that way but it looks correct.

I know why you did it that way:
$$\frac{128-119}{47-39}=\frac{119-113}{R-47}$$
Therefore
$$R=47+\frac{119-113}{128-119}(47-39)$$
Or
$$R=47+\frac{6}{9}\times8$$
 
The following users thanked this post: CaptDon

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 5053
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #13 on: August 06, 2026, 12:46:12 am »
Thanks to everyone for giving so many ways to skin this particular cat.
(Figure of speech: I love kitties.)

@golden_labels: I particularly like your visual graphical solution; have to try that sometime. Kind of like using a slide rule, yes?
Do you just mark off the points in millimeters on your triangle?

What type of timer, filter or oscillator is this for?  Normally F is proportional to 1/R. You have F as a negative linear proportion to R.

It's an astable multivibrator, where the pulse width is essentially the RC time constant, so smaller R gives higher F.
 

Online Renate

  • Super Contributor
  • ***
  • Posts: 1797
  • Country: de
    • Renate's Android Page
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #14 on: August 06, 2026, 04:48:58 am »
It's an astable multivibrator, where the pulse width is essentially the RC time constant, so smaller R gives higher F.
Then as others have said it's an inverse relationship.
Linear extrapolation will only give you a very approximate answer.
On the other hand, your points are so close.

Not presuming, but modeling this on a 555 circuit with a single resistor:
A 555 uses 1/3 set points instead of 1/e
That gives you a slower factor of 1.1
t = R * C and you you need a charge and a discharge, so a factor of 2.
f = 1 / (2.2 * R * C)
C = 1 / (2.2 * R * f)

91 pF = 1 / (2.2 * 39k * 128 kHz)

81 pF = 1 / (2.2 * 47k * 119 kHz)

Mmm, that's somewhere around +/- 5% but makes you wonder if something else is going on.

Using the 81 pF number:

113 kHz = 1 / (2.2 * 49.7k * 81 pF)

Of course the absolute value of the capacitor is fictional.
We don't know if the circuit is not 555 and is using how many "e" s of charge discharge.




 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 5053
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #15 on: August 06, 2026, 05:01:11 am »
It's the classic 2-transistor multivibrator, not a 555.

My favorite circuit.
 

Online Renate

  • Super Contributor
  • ***
  • Posts: 1797
  • Country: de
    • Renate's Android Page
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #16 on: August 06, 2026, 05:29:21 am »
It's the classic 2-transistor multivibrator, not a 555.
Well, then the other resistors and the loads play a role too, not just the pair of resistors.

When I try to reconcile the numbers for 128 kHz and 119 kHz I come up with a fictional 33 pF and a combined switching time per cycle of 5 microseconds.
Using that as a model I get 53k for 113 kHz.
 

Offline Analog KidTopic starter

  • Super Contributor
  • ***
  • Posts: 5053
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #17 on: August 06, 2026, 05:47:33 am »
Welll, not that it really matters, but I ended up with 1nf and 5.1K for the timing parts. (Target frequency is 113 KHz.)

Anyhow, it works as intended.

(I'll be posting the project here soon if anyone's interested in the gory details.)
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 2539
  • Country: pl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #18 on: August 06, 2026, 11:11:57 am »
I particularly like your visual graphical solution; have to try that sometime. Kind of like using a slide rule, yes?
Just drawing the problem and measuring the result directly. The oldest, most classical way. No maths required. :P

Imprecise, but if anything else fails, it’s still a decent estimate. Just remember that a (ball)pen has thickness: don’t get fooled by measuring things while drawing. Mark, then measure.

Do you just mark off the points in millimeters on your triangle?
Yes, but that’s only because the ruler I had at hand has mm markings.
Why 📎 | We live in times when half of people have IQ below 100.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 13125
  • Country: us
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #19 on: August 06, 2026, 02:43:38 pm »
Then as others have said it's an inverse relationship.
Linear extrapolation will only give you a very approximate answer.
On the other hand, your points are so close.

It could be made linear by plotting period (1/F) instead of F directly. The period relates to the length of time to charge the capacitor, so it would be approximately proportional to the RC product.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #20 on: August 06, 2026, 03:12:18 pm »
The canonical linear interpolation/extrapolation function is
$$y = \frac{x_2 - x}{x_2 - x_1} y_1 + \frac{x - x_1}{x_2 - x_1} y_2 = \frac{(x_2 - x) y_1 + (x - x_1) y_2}{x_2 - x_1}$$
This is numerically stable, although you do need to do two multiplications, one division, and three subtractions and one addition.  Use the right-side form, and you're golden, even if you have limited numerical precision.

If you evaluate \(y\) for many \(x\), it can be useful to regroup the values, into
$$y = \frac{x (y_2 - y_1) + x_2 y_1 - x_1 y_2}{x_2 - x_1} = \frac{ x U + V }{ W }, \left\lbrace\begin{aligned}
U &= y_2 - y_1 \\
V &= x_2 y_1 - x_1 y_2 \\
W &= x_2 - x_1 \\
\end{aligned}\right.$$
noting that if \(x_1, y_1, x_2, y_2\) are integers, then \(U, V, W\) are too.  This is numerically stable, and you don't lose any precision doing this.  Your temporaries do need the range to describe the products (magnitude of \(V\)), but no additional precision.

Bresenham's line algorithm simply tracks the error in \(y\) in reciprocal units of \(x_2 - x_1\), quite easily derived from above form.  (That way, if the coordinates are all integers, the error is always an integer in those units too.  When one realizes this, the entire Bresenham family of fast 2D raster drawing functions becomes very intuitively understandable.)

For unit interpolation using "phase" \(p\), (\(p = 0\) at \(x = x_1\), and \(p = 1\) at \(x = x_2\)), this becomes \(y = (1 - p) y_1 + p y_2\).  Again, this is numerically stable, with exact values at \(p = 0\) and \(p = 1\), with largest rounding error somewhere near the middle.  Even with floating point numbers and \(y_1\) and \(y_2\) wildly different in magnitude (so that you get "\(y_1 + y_2 = y_1\)" or "\(y_1 + y_2 = y_2\)" because of domain cancellation), the endpoints are exact, and the interpolated values are linear to within the precision available in the floating-point number type used.  Very useful.

Not so with \(y = y_1 + p (y_2 - y_1)\), which utterly fails if \(\lvert y_1 \rvert \gg \lvert y_2 \rvert\), and is offset if \(\lvert y_1 \rvert \ll \lvert y_2 \rvert\) with floating-point numbers.  It is horrifically numerically unstable, and should not be used with floating-point numbers.  It will bite you eventually; it always does.

The traditional definition of a line in a Cartesian coordinate system is (now typos fixed):
$$y = A x + B, \quad A = \frac{y_2 - y_1}{x_2 - x_1}, \quad B = \frac{x_2 y_1 - x_1 y_2}{x_2 - x_1} = y_1 - x_1 A$$
and is the worst choice if using limited precision like floating-point numbers.  Any rounding error in \(A\) means the slope is incorrect, and any rounding error in \(B\) shifts the entire line.  In computer programs using floating-point numbers, this form often leads to surprising numerical errors due to the numerical instability and sensitivity to rounding errors.  In 3D rendering, the "edge tearing" (flat surfaces meeting at a shared edge not closing up properly) is a very visible result of closely related numerical instability issues.

Apologies for the algebra gushing, but I just see too many developers get bitten by numerical instability.  I know it doesn't matter, usually; except until it actually does and the errors become noticeable.  Numerical stability is good, but often needs a small bit of extra work, as shown above.
« Last Edit: August 07, 2026, 12:10:37 pm by Nominal Animal »
 
The following users thanked this post: newbrain, golden_labels

Offline armandine2

  • Frequent Contributor
  • **
  • Posts: 969
  • Country: gb
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #21 on: August 07, 2026, 09:27:11 am »
(+1) similar triangles, ratio calculation followed by an addition

Gold Capacitor Prize - 2025
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #22 on: August 07, 2026, 02:27:37 pm »
I have similar algebraic formulas with pitfall explanations and numerically stable forms for 2-point, 3-point, 4-point, and cubic spline interpolation (sequence of points, where you calculate each interval separately, using two neighboring points to make the whole curve continuous both in y and in tangent).  Is there any interest?  ???

There are two separate categories, too: with regular sample intervals (in \(x\)), and with varying sample intervals.  The regular ones are easier, but in embedded devices consume a lot more memory/Flash than varying intervals, because with varying intervals you can put the samples where they make most sense.  Useful, if you use e.g. Maxima/Matlab/Octave/Maple/Mathematica to calculate a (highly) precise model, then sample that until you find a set that gives sufficient precision.  (I've done that before; it's a bit of drudge work, but you can optimize many things so they become fast and easy to calculate very precisely.  Pt100 and Pt1000 temperature-resistance compensation curves, for example.)

I could start a separate thread on data interpolation in general, with the formulas in first one, then other posts explaining exactly why (hopefully starting a discussion on what and when and alternatives others have used).  Again, my focus is not the simplest ones, but the ones that always work, and won't bite you in the butt in the corner cases (or at least tell you where those bite-butt corners are). 
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 13125
  • Country: us
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #23 on: August 07, 2026, 04:44:57 pm »
I have similar algebraic formulas with pitfall explanations and numerically stable forms for 2-point, 3-point, 4-point, and cubic spline interpolation (sequence of points, where you calculate each interval separately, using two neighboring points to make the whole curve continuous both in y and in tangent).  Is there any interest?  ???

Off topic for this thread, but I have in the past had the need for a monotonic spline, avoiding overshoot or oscillation artifacts. Like the example below:
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 2539
  • Country: pl
Re: [Broken brain] Help with simple graphing/algebra problem
« Reply #24 on: August 07, 2026, 07:48:34 pm »
Topics on seemingly trivial things show uncanny tendency to explode into piles of deeper and more coplicated subjects, don’t they? :)

Off topic for this thread, but I have in the past had the need for a monotonic spline, avoiding overshoot or oscillation artifacts. Like the example below:
Exactly like that, with two flat lines on the ends and no other restrictions?

For x ∈ [0, 1] and endpoints at y(0)=0 and y(1)=1, it has a nice, known form:

y = -2x3 + 3x2

This may be scaled to other ranges as needed.
Why 📎 | We live in times when half of people have IQ below 100.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->