Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RL RL is offline
external usenet poster
 
Posts: 22
Default How do I calculate simultaneous equations?

How do I calculate simultaneous equations?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default How do I calculate simultaneous equations?

Can you provide an example of what you have now and what you want to have
eventually?

Regards,
Ryan---


--
RyGuy


"RL" wrote:

How do I calculate simultaneous equations?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RL RL is offline
external usenet poster
 
Posts: 22
Default How do I calculate simultaneous equations?

21x+ 6y = 10
(7x-20)^2+(6y+10)^2=200

I only know that the solution are not integers.

"ryguy7272" wrote:

Can you provide an example of what you have now and what you want to have
eventually?

Regards,
Ryan---


--
RyGuy


"RL" wrote:

How do I calculate simultaneous equations?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calculate simultaneous equations?

Can probably done using Solver. I'm more used to Goal seek, so I rework to one variable

I use cell A2 for x and B2 for y.

Reworking 21x+6y=10:
x = (10-6y)/21
So the formula in A2 is:
=(10-6*B2)/21
In B2 I put 10 (no special reason)

In A3 the second equation:

=(7*A2-20)^2+(6*B2+10)^2

With A3 selected:

ToolsGoal seek, To value: 200, By changing cell: $B$2

I get
0.857143 for x and -1.33333 for y




--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"RL" wrote in message ...
| 21x+ 6y = 10
| (7x-20)^2+(6y+10)^2=200
|
| I only know that the solution are not integers.
|
| "ryguy7272" wrote:
|
| Can you provide an example of what you have now and what you want to have
| eventually?
|
| Regards,
| Ryan---
|
|
| --
| RyGuy
|
|
| "RL" wrote:
|
| How do I calculate simultaneous equations?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default How do I calculate simultaneous equations?

RL, this may be of some interest to you:
http://en.wikipedia.org/wiki/Quadratic_equation



--
RyGuy


"Niek Otten" wrote:

Can probably done using Solver. I'm more used to Goal seek, so I rework to one variable

I use cell A2 for x and B2 for y.

Reworking 21x+6y=10:
x = (10-6y)/21
So the formula in A2 is:
=(10-6*B2)/21
In B2 I put 10 (no special reason)

In A3 the second equation:

=(7*A2-20)^2+(6*B2+10)^2

With A3 selected:

ToolsGoal seek, To value: 200, By changing cell: $B$2

I get
0.857143 for x and -1.33333 for y




--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"RL" wrote in message ...
| 21x+ 6y = 10
| (7x-20)^2+(6y+10)^2=200
|
| I only know that the solution are not integers.
|
| "ryguy7272" wrote:
|
| Can you provide an example of what you have now and what you want to have
| eventually?
|
| Regards,
| Ryan---
|
|
| --
| RyGuy
|
|
| "RL" wrote:
|
| How do I calculate simultaneous equations?





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How do I calculate simultaneous equations?

"Niek Otten" wrote...
Can probably done using Solver. I'm more used to Goal seek, so I
rework to one variable

I use cell A2 for x and B2 for y.

Reworking 21x+6y=10:
x = (10-6y)/21
So the formula in A2 is:
=(10-6*B2)/21

....

Not enough algebra. This can be completely solved analytically. Just
substitute your expression for x based on the first equation into the
second equation. First simplify: 6y appears in both equations, so
replace it with z = 6y.

21x + z = 10
(7x - 20)^2 + (z + 10)^2 = 200

z = 10 - 21x

Then substitute the RHS for z in the second equation.

(7x - 20)^2 + (10 - 21x + 10)^2 = 200
(7x - 20)^2 + (20 - 21x)^2 = 200
49x^2 - 280x + 400 + 400 - 840x + 441x^2 = 200
490x^2 - 1120x + 800 = 200
49x^2 - 112x + 60 = 0

So x has 2 solutions

56/49 + (3136/2401 - 60/49)^0.5 and 56/49 - (3136/2401 - 60/49)^0.5

and y also has two solutions. Solver will only find one, depending on
the initial state of the variable cell. Also, the Solver solution is
approximate while the analytical solution is accurate to machine
precision. Finally, as any who uses numerical analysis in their job
will tell you, if all it takes is 10 or fewer lines of algebra to
reach an exact solution, that ALWAYS preferable to ANY iterative
approach.
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calculate simultaneous equations?

<This can be completely solved analytically

I know, Harlan. Many complex problems can be solved analytically. We don't need computers at all, apart from solving crossword
puzzles.

But I'm sure I'm not alone in preferring an iterative approach if there is an easy one.
If the first equation would have been more complex, I wouldn't even have tried.

Ten lines of algebra is ten lines of possible errors. It is for me. I'm sure it is for some others. I'm certain it is for the many
who are not familiar with the algebraic approach.

I think your limit of 10 lines is just *your* figure. Nothing to do with an objective limit.

I will not try to turn this forum into a math class.
I admit there are posters who are better helped with some education, like in the many questions about percentages.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel




"Harlan Grove" wrote in message ...
| "Niek Otten" wrote...
| Can probably done using Solver. I'm more used to Goal seek, so I
| rework to one variable
|
| I use cell A2 for x and B2 for y.
|
| Reworking 21x+6y=10:
| x = (10-6y)/21
| So the formula in A2 is:
| =(10-6*B2)/21
| ...
|
| Not enough algebra. This can be completely solved analytically. Just
| substitute your expression for x based on the first equation into the
| second equation. First simplify: 6y appears in both equations, so
| replace it with z = 6y.
|
| 21x + z = 10
| (7x - 20)^2 + (z + 10)^2 = 200
|
| z = 10 - 21x
|
| Then substitute the RHS for z in the second equation.
|
| (7x - 20)^2 + (10 - 21x + 10)^2 = 200
| (7x - 20)^2 + (20 - 21x)^2 = 200
| 49x^2 - 280x + 400 + 400 - 840x + 441x^2 = 200
| 490x^2 - 1120x + 800 = 200
| 49x^2 - 112x + 60 = 0
|
| So x has 2 solutions
|
| 56/49 + (3136/2401 - 60/49)^0.5 and 56/49 - (3136/2401 - 60/49)^0.5
|
| and y also has two solutions. Solver will only find one, depending on
| the initial state of the variable cell. Also, the Solver solution is
| approximate while the analytical solution is accurate to machine
| precision. Finally, as any who uses numerical analysis in their job
| will tell you, if all it takes is 10 or fewer lines of algebra to
| reach an exact solution, that ALWAYS preferable to ANY iterative
| approach.


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I calculate simultaneous equations?


"Niek Otten" wrote in message
...
<This can be completely solved analytically

I know, Harlan. Many complex problems can be solved analytically. We don't
need computers at all, apart from solving crossword
puzzles.

But I'm sure I'm not alone in preferring an iterative approach if there is
an easy one.
If the first equation would have been more complex, I wouldn't even have
tried.

Ten lines of algebra is ten lines of possible errors. It is for me. I'm
sure it is for some others. I'm certain it is for the many
who are not familiar with the algebraic approach.

I think your limit of 10 lines is just *your* figure. Nothing to do with
an objective limit.

I will not try to turn this forum into a math class.
I admit there are posters who are better helped with some education, like
in the many questions about percentages.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel




"Harlan Grove" wrote in message
...
| "Niek Otten" wrote...
| Can probably done using Solver. I'm more used to Goal seek, so I
| rework to one variable
|
| I use cell A2 for x and B2 for y.
|
| Reworking 21x+6y=10:
| x = (10-6y)/21
| So the formula in A2 is:
| =(10-6*B2)/21
| ...
|
| Not enough algebra. This can be completely solved analytically. Just
| substitute your expression for x based on the first equation into the
| second equation. First simplify: 6y appears in both equations, so
| replace it with z = 6y.
|
| 21x + z = 10
| (7x - 20)^2 + (z + 10)^2 = 200
|
| z = 10 - 21x
|
| Then substitute the RHS for z in the second equation.
|
| (7x - 20)^2 + (10 - 21x + 10)^2 = 200
| (7x - 20)^2 + (20 - 21x)^2 = 200
| 49x^2 - 280x + 400 + 400 - 840x + 441x^2 = 200
| 490x^2 - 1120x + 800 = 200
| 49x^2 - 112x + 60 = 0
|
| So x has 2 solutions
|
| 56/49 + (3136/2401 - 60/49)^0.5 and 56/49 - (3136/2401 - 60/49)^0.5
|
| and y also has two solutions. Solver will only find one, depending on
| the initial state of the variable cell. Also, the Solver solution is
| approximate while the analytical solution is accurate to machine
| precision. Finally, as any who uses numerical analysis in their job
| will tell you, if all it takes is 10 or fewer lines of algebra to
| reach an exact solution, that ALWAYS preferable to ANY iterative
| approach.

++++++++++++++++++++++++++++++++++++++++++++++++=
Using Solver to solve these equation sets is a disaster. You cannot rely on
the accuracy of the results, which generally are only accurate to 2-3
decimal digits. Most of the time it is not accurate to any decimal digit.
The algorithm is faulty.

David Heiser


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 837
Default How do I calculate simultaneous equations?

Solver's default settings greatly limit its accuracy, but I can usually tweak
it to get what I want. Goal Seek seems to permit far less user control.
However, I suspect that most algorithms would perform poorly when asked to
numerically solve an n-dimensional problem that analytically reduces to an
n-k (k0) dimensional problem. Do the analytical reduction as Harlan
suggested, then apply appropriate methods to the problem that remains.

If the algebra is tedious, download Maxima
http://maxima.sourceforge.net
which is a free symbolic math program. In Maxima,
solve ([21*x+ 6*y = 10, (7*x-20)^2+(6*y+10)^2=200], [x,y]);
returns the two solutions to the reduced quadratic equation
[x=10/7,y=-10/3],[x=6/7,y=-4/3]
With more complicated equations, you might get a reduction that actually
requires a numerical solution, but with a clear picture of the actual
dimensionality of the problem, Solver will perform much better.

Jerry

"David A. Heiser" wrote:

Using Solver to solve these equation sets is a disaster. You cannot rely on
the accuracy of the results, which generally are only accurate to 2-3
decimal digits. Most of the time it is not accurate to any decimal digit.
The algorithm is faulty.

David Heiser

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calculate simultaneous equations?

<Goal Seek seems to permit far less user control

I don't think so. Goal Seek takes its parameters from the Iteration dialog: the max number of "iterations" and the maximum change,
which can be set to what Harlan called "machine precision".

Not that I want to restart the discussion about how desirable such a solution is, just to indicate that accuracy should not be an
issue.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"Jerry W. Lewis" wrote in message ...
| Solver's default settings greatly limit its accuracy, but I can usually tweak
| it to get what I want. Goal Seek seems to permit far less user control.
| However, I suspect that most algorithms would perform poorly when asked to
| numerically solve an n-dimensional problem that analytically reduces to an
| n-k (k0) dimensional problem. Do the analytical reduction as Harlan
| suggested, then apply appropriate methods to the problem that remains.
|
| If the algebra is tedious, download Maxima
| http://maxima.sourceforge.net
| which is a free symbolic math program. In Maxima,
| solve ([21*x+ 6*y = 10, (7*x-20)^2+(6*y+10)^2=200], [x,y]);
| returns the two solutions to the reduced quadratic equation
| [x=10/7,y=-10/3],[x=6/7,y=-4/3]
| With more complicated equations, you might get a reduction that actually
| requires a numerical solution, but with a clear picture of the actual
| dimensionality of the problem, Solver will perform much better.
|
| Jerry
|
| "David A. Heiser" wrote:
|
| Using Solver to solve these equation sets is a disaster. You cannot rely on
| the accuracy of the results, which generally are only accurate to 2-3
| decimal digits. Most of the time it is not accurate to any decimal digit.
| The algorithm is faulty.
|
| David Heiser




  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 947
Default How do I calculate simultaneous equations?

The Newton Method can sometimes be useful, and done in only a very few
loops.
It would be easy to adapt to a more general equation.
I might put the circle equation into its other form:

'49*x^2 - 280*x + 36*y^2 + 120*y + 300 = 0

Sub TestIt()
'// Enter two guesses for x & y
Debug.Print LineCircle(1, 1)
Debug.Print LineCircle(2, -3)
End Sub

Returns the two solutions:

X: 0.8571428571428571428571428571 Y: -1.3333333333333333333333333333
X: 1.4285714285714285714285714286 Y: -3.3333333333333333333333333333



Function LineCircle(gx, gy) As Variant
Dim a, b, c, d, x, y, v1, v2
Dim J As Long

'// Jacobian of Line
a = CDec(21): b = CDec(6)
x = gx: y = gy

For J = 1 To 10
v1 = 10 - 21 * x - 6 * y
v2 = -49 * x * x + 280 * x - 36 * y * y - 120 * y - 300
c = 98 * x - 280
d = 24 * (5 + 3 * y)

x = x + (d * v1 - b * v2) / (a * d - b * c)
y = y + (c * v1 - a * v2) / (b * c - a * d)
Next J
LineCircle = "X: " & CStr(x) & " Y: " & CStr(y)
End Function

--
Dana DeLouis
Excel 2007



"Niek Otten" wrote in message
...
<Goal Seek seems to permit far less user control

I don't think so. Goal Seek takes its parameters from the Iteration
dialog: the max number of "iterations" and the maximum change,
which can be set to what Harlan called "machine precision".

Not that I want to restart the discussion about how desirable such a
solution is, just to indicate that accuracy should not be an
issue.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"Jerry W. Lewis" wrote in message
...
| Solver's default settings greatly limit its accuracy, but I can usually
tweak
| it to get what I want. Goal Seek seems to permit far less user control.
| However, I suspect that most algorithms would perform poorly when asked
to
| numerically solve an n-dimensional problem that analytically reduces to
an
| n-k (k0) dimensional problem. Do the analytical reduction as Harlan
| suggested, then apply appropriate methods to the problem that remains.
|
| If the algebra is tedious, download Maxima
| http://maxima.sourceforge.net
| which is a free symbolic math program. In Maxima,
| solve ([21*x+ 6*y = 10, (7*x-20)^2+(6*y+10)^2=200], [x,y]);
| returns the two solutions to the reduced quadratic equation
| [x=10/7,y=-10/3],[x=6/7,y=-4/3]
| With more complicated equations, you might get a reduction that actually
| requires a numerical solution, but with a clear picture of the actual
| dimensionality of the problem, Solver will perform much better.
|
| Jerry
|
| "David A. Heiser" wrote:
|
| Using Solver to solve these equation sets is a disaster. You cannot
rely on
| the accuracy of the results, which generally are only accurate to 2-3
| decimal digits. Most of the time it is not accurate to any decimal
digit.
| The algorithm is faulty.
|
| David Heiser


  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How do I calculate simultaneous equations?

"Niek Otten" wrote...
<This can be completely solved analytically

I know, Harlan. Many complex problems can be solved analytically.
We don't need computers at all, . . .


Intentionally oversimplified bombast.

There are many situations in which iterative approaches are necessary.
This just isn't one of them. Problems with analytical solutions that
can be achieved with 10 or fewer lines of algebra will always produce
more accurate results and likely take no more time than would be
needed to set up the problem in Solver.

But I'm sure I'm not alone in preferring an iterative approach if
there is an easy one.

....

More's the pity. Making laziness (and ignorance?) into a virtue?

I think your limit of 10 lines is just *your* figure. Nothing to do
with an objective limit.


True. Let me rephrase: analytical solutions are always as accurate if
not more accurate than iterative solutions. There's a trade-off
between the time and effort needed for some analytical solutions vs
the speed of less accurate but accurate enough iterative solutions.

I will not try to turn this forum into a math class.


So you'll ignore math unless absolutely necessary? Well, at least
you've internalized Microsoft's long term intentions for Excel.

But how about the other point I raised? The OP's equations have **2**
equally valid solutions. Given any initial conditions, Solver will
only produce one of them. You don't view this as a deficiency of the
Solver approach?
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How do I calculate simultaneous equations?

"Niek Otten" wrote...
....
I don't think so. Goal Seek takes its parameters from the Iteration
dialog: the max number of "iterations" and the maximum change,
which can be set to what Harlan called "machine precision".


Iteration dialog? Do you mean the Iteration section of the Calculation
tab in the Options dialog? If so, maximum change can't be set to
machine precision. So it'd seem a safe bet you don't know what machine
precision means.

Not that I want to restart the discussion about how desirable such
a solution is, just to indicate that accuracy should not be an
issue.


OK, so you don't care much about accuracy. Nice to know.
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calculate simultaneous equations?

<maximum change can't be set to machine precision

Of course there is no such thing as "machine precision", but I used your words because it's a nice way to describe precision of
the algorithms used.

If I set Maximum change to 0.000000000000001 I get the same answer as with your formula, in both cases (using Excel) with same
number of significant digits:
1.42857142857143. That is with a start value for y of -100. If I use 100 , I get the other set of values.

Of course I could have calculated your formulas manually to more digits.

<OK, so you don't care much about accuracy

Please don't twist my words

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Harlan Grove" wrote in message ...
| "Niek Otten" wrote...
| ...
| I don't think so. Goal Seek takes its parameters from the Iteration
| dialog: the max number of "iterations" and the maximum change,
| which can be set to what Harlan called "machine precision".
|
| Iteration dialog? Do you mean the Iteration section of the Calculation
| tab in the Options dialog? If so, maximum change can't be set to
| machine precision. So it'd seem a safe bet you don't know what machine
| precision means.
|
| Not that I want to restart the discussion about how desirable such
| a solution is, just to indicate that accuracy should not be an
| issue.
|
| OK, so you don't care much about accuracy. Nice to know.


  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How do I calculate simultaneous equations?

"Niek Otten" wrote...
<maximum change can't be set to machine precision

Of course there is no such thing as "machine precision", but I used
your words because it's a nice way to describe precision of the
algorithms used.


Machine precision means, in the case of IEEE double precision floating
point, numbers that can be represented exactly using 1 sign bit, 11
bits for the base-2 order and 52 bits for the base-2 fractional part.

For something that 'of course', Google shows well over 80,000 hits for
"machine precision". Maybe they're all cruft, but a lot of them seem
to be hosted by universities. What do you know that the professors
involved don't?

If I set Maximum change to 0.000000000000001 I get the same answer
as with your formula, in both cases (using Excel) with same number
of significant digits: 1.42857142857143. . . .

....

This may work in this case, but sometimes the significant digits are
further away from the decimal point. If the highest/lowest order
significant digit were 12 decimal places away from the decimal point,
you're going to have trouble with the maximum change entry.


  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calculate simultaneous equations?

<| For something that 'of course', Google shows well over 80,000 hits for
| "machine precision". Maybe they're all cruft, but a lot of them seem
| to be hosted by universities. What do you know that the professors
| involved don't?

OK, If that is the general meaning of the term, then I accept that of course. I'm certainly not going to check all your 80,000
hits to check that they really are professors.........
I just pointed out (not that you didn't know), that the machine can be programmed to any precision. And IEEE is certainly not the
only built-in limited precision calculation algorithm.

<| This may work in this case, but sometimes the significant digits are
| further away from the decimal point. If the highest/lowest order
| significant digit were 12 decimal places away from the decimal point,
| you're going to have trouble with the maximum change entry

You're right. Certainly in this example.
In my own models I never goalseek the result to a value, I always goalseek the fractional difference between result and goal to be
zero. If you do that with 0.000000000000001 for Maximum change, you may need a few more iterations, but you'll be as close as is
possible within the IEEE limitations.


--
Kind regards,

Niek Otten
Microsoft MVP - Excel



"Harlan Grove" wrote in message ...
| "Niek Otten" wrote...
| <maximum change can't be set to machine precision
|
| Of course there is no such thing as "machine precision", but I used
| your words because it's a nice way to describe precision of the
| algorithms used.
|
| Machine precision means, in the case of IEEE double precision floating
| point, numbers that can be represented exactly using 1 sign bit, 11
| bits for the base-2 order and 52 bits for the base-2 fractional part.
|
| For something that 'of course', Google shows well over 80,000 hits for
| "machine precision". Maybe they're all cruft, but a lot of them seem
| to be hosted by universities. What do you know that the professors
| involved don't?
|
| If I set Maximum change to 0.000000000000001 I get the same answer
| as with your formula, in both cases (using Excel) with same number
| of significant digits: 1.42857142857143. . . .
| ...
|
| This may work in this case, but sometimes the significant digits are
| further away from the decimal point. If the highest/lowest order
| significant digit were 12 decimal places away from the decimal point,
| you're going to have trouble with the maximum change entry.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Circular References - Simultaneous Equations Andrew Excel Discussion (Misc queries) 8 November 4th 08 01:17 PM
How do I do simultaneous AND and OR filtering ? Motown Mick Excel Discussion (Misc queries) 3 August 21st 07 02:32 AM
simultaneous subtotals johnny vino Excel Discussion (Misc queries) 1 September 22nd 06 10:11 PM
solving for 2 unknowns using 2 simultaneous equations elaturnas Excel Discussion (Misc queries) 1 February 8th 05 07:29 PM
solving for 3 unknowns using 3 simultaneous equations elaturnas Excel Discussion (Misc queries) 0 February 8th 05 04:37 PM


All times are GMT +1. The time now is 09:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"