Friday Night Maths

Man of Honour
Joined
13 Nov 2009
Posts
11,666
Location
Northampton
My brain is toast.

I have an equation I need to reverse to Solve both A & B, any care to school me?

((A*256)+B)/4 = 748
 
Last edited:
((A*256)+B)/4 = 748
(A*256)+B = 2992
A*256 = 2992-B
A = (2992-B)/256
B = 2992-(A*256)

If B = 1 then A = 11.68359375

My maths is ***** but do you not need to know at least one of A or B to find the other?
 
My brain is toast.

I have an equation I need to reverse to Solve both A & B, any care to school me?

((A*256)+B)/4 = 748

You might want to explain what you're trying to do here OP - give some context or further details etc...

You've got two unknown variables so currently, without any other conditions, they there are infinite values they can take.. for example when B is 0 A is 11.6875 and when A is zero B is 2992.

If you want to illustrate this then, with A on the x axis and B on the y axis, if you were to draw a line passing through (0, 2992) and (11.6875, 0) any point along that line gives you a value for A and B
 
My maths is ***** but do you not need to know at least one of A or B to find the other?

If you've got another equation involving A and B then you're good. Think back to simultaneous equations at school - if you've got two equations with the two unknowns then you can substitute in and solve for one of the variables etc... If you plot both lines you're basically finding the intercept.
 
I think I may have solved it from a mathematically concept. Just trying to confirm try the maths on a few inputs ...Not quite for the application

You might want to explain what you're trying to do here OP - give some context or further details etc...

You've got two unknown variables so currently, without any other conditions, they there are infinite values they can take.. for example when B is 0 A is 11.6875 and when A is zero B is 2992.

If you want to illustrate this then, with A on the x axis and B on the y axis, if you were to draw a line passing through (0, 2992) and (11.6875, 0) any point along that line gives you a value for A and B

Sending data over a serial like protocol that deals with hexadecimal. The receiving device performs the formula in the OP to convert the data it receives to a real value.

All of the values must be integers (non-decimal)
 
((A*256)+B)/4 = 748

if A=11 (can't be over 11 round number otherwise it is over 748*4 so can't add B) based on the earlier 11.68359375

((11*256)+B)/4 = 748

2816+B = 2992

b = 2992 - 2816 = 176

b=176, a=11 seems to work .
 
B is 176 and A is 11

I did 748 * 4

Then 2992 divided by 256 which was 11.something

So I then assumed that A was 11 and then took the difference from 2992 to give me B.
 
Do they need to be positive? Non-zero? That might narrow it down a bit too...

Currently you still have a bunch of possible answers

A = 0, A = 1, A = 2 etc.. all give you integer values for B

Mentioning hex wasn't clear enough. Neither A or B can be greater than 255
 
Last edited:
Back
Top Bottom