List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] solving linear equation
| [MUG] solving linear equation |
|
Author: Alain Goupil
Posted: 19/10/2000 17:34:45 GDT
|
>> From: Alain Goupil "goupil"
Dear maple users,
Here is a problem :
The following maple command for solving the linear equation
2x+3y=ax+by for a and b does not return the expected answer :
> solve({2*x+3*y=a*x+b*y},{a,b});
{a = (2*x+3*y-b*y)/x, b = b}
Is there a way to obtain the answer a=2, b=3 straightforwardly with
the solve command ? I know that I could use matrices or the coeff
command but I want to stay elementary.
Thank you,
Alain Goupil
|
| [MUG] Re: solving linear equation |
|
Author: Maple Group
Posted: 23/10/2000 13:56:28 GDT
|
>> From: Maple Group "maple_gr"
| >> From: Alain Goupil "goupil"
| The following maple command for solving the linear equation
| 2x+3y=ax+by for a and b does not return the expected answer :
|
| > solve({2*x+3*y=a*x+b*y},{a,b});
| {a = (2*x+3*y-b*y)/x, b = b}
|
| Is there a way to obtain the answer a=2, b=3 straightforwardly with
| the solve command ? I know that I could use matrices or the coeff
| command but I want to stay elementary.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 20 Oct 2000 16:10:17 -0500
From: Robert J Lopez "r.lopez"
Subject: solving linear equation
To: "maple-list"
Use the solve/identity command.
solve(identity(2*x+3*y=a*x+b*y,x),{a,b});
RJL
--
Robert J. Lopez
Department of Mathematics
Rose-Hulman Institute of Technology
Terre Haute, IN 47803
812 877-8396 (office)
812 877-8883 (Department fax)
"r.lopez"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 20 Oct 2000 17:27:32 -0400
From: "David L. Johnson" "david.johnson"
To: "maple-list"
Subject: solving linear equation
Well, I don't know if this is what you mean, but:
solve({subs({x=1,y=0},2*x+3*y=a*x+b*y),subs({x=0,y=1},2*x+3*y=a*x+b*y)},{a,b});
works
You have to convince Maple that the numbers a and b play a different role than
x. As far as it's concerned they are all variables. To solve for the two
variables {a,b} you need two equations. Using coeff will do that, but so does
this, clearly.
--
David L. Johnson "david.johnson"
Department of Mathematics http://www.lehigh.edu/~dlj0/dlj0.html
Lehigh University
14 E. Packer Avenue (610) 758-3759
Bethlehem, PA 18015-3174
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Nathan Sokalski" "njsokalski"
To: "maple-list"
Subject: solving linear equation
Date: Sat, 21 Oct 2000 00:35:40 EDT
The reason you do not recieve a=2, b=3 is because that is not the only
correct solution. if you go through the following process, you can see where
Maple gets its answer:
2x+3y=ax+by
2x+3y-by=ax
(2x+3y-by)/x=a
You can also see by looking at these simple Maple statements that this is
always true:
STUDENT>restart;
STUDENT>a:=(2*x+3*y-b*y)/x;
2x+3y-by
a:= ----------
x
STUDENT>testeq(a*x+b*y=2*x+3*y);
true
STUDENT>b:=37;a;
b:=37
2x-34y
a:=--------
x
STUDENT>a*x+b*y;
2x+3y
If you enter these commands into Maple, notice that you can change the value
of b (it is 37 in the example) to any value you want, but you will always
recieve 2x+3y when entering a*x+b*y
Nathan Sokalski
"njsokalski"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "wh.werner" (wh.werner)
To: "maple-list"
Subject: solving linear equation
Date: Sat, 21 Oct 2000 10:11:56 +0200
Hallo.
I guess you implicitly assumed that your equation 2*x+3*y=a*x+b*y is valid
for any value of x and y. You did'nt pass this information to Maple however!
So don't expect that Maple can return another answer than it does. If you
use the "coeff" command however this implies all information concerning the
expected solution.
Regards
Wilhelm Werner
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: Gaston Gonnet "gonnet"
Date: Sat, 21 Oct 2000 19:00:08 +0200 (MET DST)
To: "maple-list"
Subject: solving linear equation
In this case you can use "identity", e.g.
> solve( identity( 2*x+3*y=a*x+b*y, x), {a,b} );
{a = 2, b = 3}
(This works for only one variable, in the case above it was enough)
See ?solve,identity for more details.
Gaston Gonnet
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Daniel Frenkel" "jfrenkel"
To: "maple-list"
Subject: solving linear equation
Date: Sat, 21 Oct 2000 21:30:53 -0200
Dear Alain,
Try using "match" command:
> match(2*x+3*y=a*x+b*y,{x,y},'s');
true
> s;
{b = 3, a = 2}
Cheers,
Daniel Frenkel
"frenkel"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Mon, 23 Oct 2000 10:29:05 +0200 (CEST)
From: "elbr"
To: "maple-list"
Subject: solving linear equation
You have to use a variant of solve (see solve,identity)::
2*x+3*y=a*x+b*y;
solve(identity(%,x),{a,b});
2 x + 3 y = a x + b y
{b = 3, a = 2}
E. Elbraechter
----------------------------------
E-Mail: "elbr"
Date: 23-Oct-2000
Time: 10:22:25
----------------------------------
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Mon, 23 Oct 2000 12:35:06 +0100
From: Barsuhn "barsuhn"
Subject: solving linear equation
To: "maple-list"
Dear Alain,
your equation has infinitely many solutions, among these is a=2, b=3. If
you insert b=3 into the formula you found for a, you get a=2.
I suppose you wish to do something quite different. You see that your
expression 2x+3y is of the type ax+by and would like to see which values
for a and b will lead to an exact match. This is done by the following
statements. The first statement finds that the attempt to match
succeeds. The equations that yield the exact match are assigned to the
variable substitution:
> match(2*x+3*y=a*x+b*y,{x,y},'substitution');
true
> substitution;
All the best Jurgen {b = 3, a = 2}
--
-------------------
Prof. Dr. Jurgen Barsuhn
Fachhochschule Bielefeld
University of Applied Sciences
Fachbereich Elektrotechnik und Informationstechnik
Wilhelm-Bertelsmann-Str. 10
D-33602 Bielefeld
-----------
|
| [MUG] Re: solving linear equation |
|
Author: Maple Group
Posted: 31/10/2000 01:12:22 GMT
|
>> From: Maple Group "maple_gr"
Alain Goupil wrote:
| The following maple command for solving the linear equation
| 2x+3y=ax+by for a and b does not return the expected answer :
|
| > solve({2*x+3*y=a*x+b*y},{a,b});
| {a = (2*x+3*y-b*y)/x, b = b}
|
| Is there a way to obtain the answer a=2, b=3 straightforwardly with
| the solve command ? I know that I could use matrices or the coeff
| command but I want to stay elementary.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Tue, 24 Oct 2000 11:22:23 +0100
From: "Dr Francis J. Wright" "F.J.Wright"
To: "goupil"
Subject: solving linear equation
You only expect the answer a=2, b=3 because you know that x and y are
variables (rather than constants) and that they are independent;
otherwise, your expectation would not be correct. So you need to
provide Maple with this additional information. As you remark, this
could be done using coeff. Another way is to use partial
differentiation to express the independence of x and y, as follows,
where the final solve is almost superfluous:
> 2*x+3*y=a*x+b*y;
2 x + 3 y = a x + b y
> map2(diff, %, {x,y});
{2 = a, 3 = b}
> solve(%, {a,b});
{a = 2, b = 3}
Francis
--
Dr Francis J. Wright | mailto: "F.J.Wright"
School of Mathematical Sciences | tel: (020) 7882 5453 (direct)
Queen Mary, University of London | fax: (020) 8981 9587 (dept.)
Mile End Road, London E1 4NS, UK | http://centaur.maths.qmw.ac.uk/
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Wed, 25 Oct 2000 09:07:28 -0500
From: Herman Jaramillo "herman.jaramillo"
To: "maple-list"
Subject: solving linear equation
You have one linear equation with two unknowns. The solution is a
stright line. (2,3) happens to be one point of that line, but
Maple is giving you all solutions (one degree of freedom "b")
--
Herman Jaramillo phone: 713-689-6503
Research Geophysicist fax : 713-689-6100
Baker Hughes (Western Geophysical) email: "herman.jaramillo"
3600 Briarpark Drive (77042-5275)
P.O. Box 2469
Houston, Texas 77252-2469
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Willard, Daniel Dr DUSA-OR" "Daniel.Willard"
To: "''" "maple-list"
Subject: solving linear equation
Date: Mon, 23 Oct 2000 10:26:28 -0400
I am afraid you are uninformed about solving linear, or perhaps non-linear
too, equations. To solve for two variables (a and b) you need two equations.
Consider a graph in which a and b are plotted on perpendicular axes.
Assuming that you know x and y, the plot of ax + by is a line, not a point.
You need a second line intersecting it at that point to have such a
solution. Maple cannot do the impossible; it has done what it can with your
statement of the problem.
|
Previous by date: [MUG] Re: printing plots with G-4, Bauldrywc
Next by date: [MUG] Step-by-step solving and verifying of differential equations, Chuck Baker
Previous thread: [MUG] table -> plot3d in Maple V R 4, Franck Courchamp
Next thread: [MUG] Step-by-step solving and verifying of differential equations, Chuck Baker
|