Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Twitter Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Maple Home
Maple 15 Professional
Maple 15 Academic
Maple 15 Student Use
What's New in Maple 15
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes and
Connectors


Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Re: simplify or subs

Search email archive for  

[MUG] Re: simplify or subs
Author: Maple Group    Posted: 24/11/2000 14:22:41 GMT
>> From: Maple Group

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Mon, 20 Nov 2000 13:08:51 -0500
To:
From: "Gerald A. Edgar"
Subject: simplify or subs

zxl wrote:

>
>[>`E`:=y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;
>
>i want a[1]^2+4*a[2] replace by b[2];
>2*a[4]+a[1]*a[3] replace by b[4] and
>a[3]^4+4*a[6] by b[6]


a[3]^4 here does not match a[3]^2 in E. I assume below you
mean a[3]^2.

>
>i mean
>b[2]:=a[1]^2+4*a[2];
>b[4]:=2*a[4]+a[1]*a[3];
>b[6]:=a[3]^4+4*a[6];
>
>but
>[>subs({a[1]^2+4*a[2]=b[2],2*a[4]+a[1]*a[3]=b[4],a[3]^4+4*a[6]=b[6]},`E`);
>doesn't work.
>

Using a bit of user input, here is what I came up with:

> E:=y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;

2 3 2 2
E := y = x + (1/4 a[1] + a[2]) x + (1/2 a[1] a[3] + a[4]) x

2
+ a[6] + 1/4 a[3]

> eqns := {a[1]^2+4*a[2]=b[2],
> 2*a[4]+a[1]*a[3]=b[4],
> a[3]^2+4*a[6]=b[6]};

2
eqns := {a[3] + 4 a[6] = b[6], 2 a[4] + a[1] a[3] = b[4],

2
a[1] + 4 a[2] = b[2]}

> eqns2 := solve(eqns,{a[2],a[4],a[6]});

2
eqns2 := {a[2] = - 1/4 a[1] + 1/4 b[2],

2
a[6] = - 1/4 a[3] + 1/4 b[6],

a[4] = - 1/2 a[1] a[3] + 1/2 b[4]}

> eval(E,eqns2);

2 3 2
y = x + 1/4 b[2] x + 1/2 b[4] x + 1/4 b[6]

The user input was choosing which three of the a's to solve for.


--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Tue, 21 Nov 2000 00:27:53 -0500
From: "Douglas B. Meade"
To:
Subject: simplify or subs

Dear MUG:

I recently responded to a similar question on the Maple newsgroup. But,
here is a similarly worded response in this forum.

You can oftentimes achieve your desired goal by using the algsubs
command (see ?algsubs for a full description). However, there are many
occasions when algsubs is not sufficient. In those cases it is
frequently beneficial to introduce an artificial parameter for the
expression of interest and to proceed as follows:

> F2 := subs( a[2]=(b[2]-a[1]^2)/4, F );
> F3 := simplify( F2 );

If you would like to see F expressed in terms of a[1]^2+4*a[2] (instead
of b[2]), add the command:

> F4 := subs( b[2]=a[1]^2+4*a[2], F3 );

I hope this helps,

Doug
--------------------------------------------------------------------------

Douglas B. Meade Phone: (803) 777-6183 FAX: (803)
777-6527
Department of Mathematics E-mail:
USC, Columbia, SC 29208 URL: http://www.math.sc.edu/~meade/




-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: "Colin Birch"
To:
Date: Tue, 21 Nov 2000 11:13:55 +0000
Subject: simplify or subs

This seems to be a frequent problem in Maple.

A common problem with subs() is the temptation to ask Maple to
replace expressions rather than variables. Replacing expressions only
works in very simple cases. Often the successful approach is to
reverse the substitution equations by simply using solve().

Try this. I have changed your equation for b[6], because I think you
had a typo.
> restart;
> eqn1:=b[2]=a[1]^2+4*a[2];
> eqn2:=b[4]=2*a[4]+a[1]*a[3];
> eqn3:=b[6]=a[3]^2+4*a[6];

> sol1:=solve({eqn1,eqn2,eqn3},{a[1],a[2],a[3],a[4],a[6]});

2
sol1 := {a[2] = 1/4 b[2] - 1/4 a[1] ,
a[4] = 1/2 b[4] - 1/2 a[1] a[3], a[6] = 1/4 b[6] - 1/4 a[3] ,
a[1] = a[1], a[3] = a[3]}

> E:=y^2 =
> x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;

> subs(sol1,E);


2 3 2
y = x + 1/4 b[2] x + 1/2 b[4] x + 1/4 b[6]

QED.
--------------------------------------------------------------------------
Colin Birch
Plant Ecology and Community Dynamics Programme,
MLURI, Craigiebuckler, Aberdeen, AB15 8QH, UK
E-mail:
Tel/Fax: +44 1224 318611/311556
--------------------------------------------------------------------------


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Tue, 21 Nov 2000 07:34:35 -0600
From: Herman Jaramillo
To:
Subject: simplify or subs

First of all, I believe that in b[6] you want


a[3]^2+4*a[6]=b[6] #note that a[3] should be to the second
power

Next instruction does what you want.



subs({a[1]^2/4+a[2]=b[2]/4,a[4]+a[1]*a[3]/2=b[4]/2,a[3]^2/4+a[6]=b[6]/4},`E`);

Regards.

Herman.


--
Herman Jaramillo phone: 713-689-6503
Research Geophysicist fax : 713-689-6100
Baker Hughes (Western Geophysical) email:
3600 Briarpark Drive (77042-5275)
P.O. Box 2469
Houston, Texas 77252-2469

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: "Symancyk, Daniel"
To:
Subject: simplify or subs
Date: Tue, 21 Nov 2000 13:44:37 -0500

subs does not work because it performs substitutions only on operands of the
original expression. Use algsubs instead. Note that I've changed the
exponent in the third substitution to make it consistent with the original
E.

The following should do what you want.

> E:=y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;
> F:=algsubs(a[1]^2+4*a[2]=b[2],E);
> G:=algsubs(2*a[4]+a[1]*a[3]=b[4],F);
> H:=algsubs(a[3]^2+4*a[6]=b[6],G);




Dan Symancyk
Department of Mathematics
Anne Arundel Community College
Arnold, MD 21012
410-541-2587



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Wed, 22 Nov 2000 12:58:02 +0900
To:
From: tanaka
Subject: simplify or subs


In this case, we should not use "subs", but "simplify".
Try the followings;

>`E`:=y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;
>siderule1:=a[1]^2+4*a[2]=b[2];
siderule2:=2*a[4]+a[1]*a[3]=b[4];
siderule3:=a[3]^2+4*a[6]=b[6];
>simplify(`E`,{siderule1,siderule2,siderule3});

And if the descending powers in x is expected, evaluate the following
procedure;

>sort(%,[x]);

We finally have

y^2 = x^3+1/4*b[2]*x^2+1/2*b[4]*x+1/4*b[6]

--------------------------------------------------------------------

Dr.TANAKA, Kazuo,
Canon Inc., Tokyo, Japan



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Wed, 22 Nov 2000 11:30:26 +0100 (CET)
From:
To:
Subject: simplify or subs

In the online help of `algsubs' you can find :
The function algsubs performs an algebraic substitution,
replacing occurrences of a with b in the expression f.
It is a generalization of the subs command,
which only handles syntactic substitution.

Therefore 'subs' is not the appropriate routine for your problem.
For example the term x^3 can be changed with `subs', but the parameter E must be
written without ' (Apostrophe).

>subs(x^3 = z, E);

y^2 = z+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2.

A call of subs(...., 'E') try to substitute something in the name E since 'E' is
unevaluated.

One way to do your work is to use `simplify/siderels` :

E:=y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+(1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]]^4;

eqs := a[1]^2+4*a[2] = b[2]
> , 2*a[4]+a[1]*a[3] = b[4]
> , a[3]^4+4*a[6] = b[6]
> ;

> simplify(E, {eqs});
2 3 2
y = x + 1/4 x b[2] + 1/2 x b[4] + 1/4 b[6]

(I have set the last term to 1/4*a[3]^4 instead of 1/4*a[3]^2 to make the
substitution meaningful)

E. Elbraechter
----------------------------------
E-Mail:
Date: 22-Nov-2000
Time: 10:55:52
----------------------------------



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: Stanley J Houghton
Date: Wed, 22 Nov 2000 13:24:12 +0000
To: zxl
Subject: simplify or subs

You need to use algsubs but it only takes one
substitution equation at a time. Thus apply it
sequentially in this way:

> `E`:=
> y^2 = x^3+(1/4*a[1]^2+a[2])*x^2+
> (1/2*a[1]*a[3]+a[4])*x+a[6]+1/4*a[3]^2;
> algsubs(a[1]^2+4*a[2]=b[2],`E`);
> algsubs(2*a[4]+a[1]*a[3]=b[4],%);
> algsubs(a[3]^2+4*a[6]=b[6],%);

I think this gives you what you want.

Incidentally, note that I reduced the fourth power of a[3] in the last
condition to the second power. From the equation `E`, I assume this is
what you wanted.

Regards
Stan



[View Complete Thread]



Previous by date: [MUG] Re: Numerical integration of functions with singularity, Robert Israel
Next by date: [MUG] Re: NEWBY with problems with Maple 6.01 and Linux, Maple Group
Previous thread: [MUG] How do I get Maple output into a report?,  Larry Fasnacht
Next thread: [MUG] NEWBY with problems with Maple 6.01 and Linux, Andre Estel



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maple 15 & MapleSim 5 Professional Brochure
Maple 15 Academic Datasheet
Maple 15 & MapleSim 5 Brochure - Academic Brochure
Maple 15 New Features data sheet
Maple 15 New Features - Flyer
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper: Technological Superiority in Multi-Domain Physical Modeling and Simulation

Latest Downloads

Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
Maple Player for iPad - App
Maple Player for iPad - Datasheet
Case Study - Multi-Domain Modelling Critical to Unmanned Vehicle Designs

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks

Latest News

NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
NASA’s Jet Propulsion Laboratory begins widespread adoption of Maplesoft technology
Latest release marks the 10th anniversary of Maple T.A.
Maple Case Study: The Changing Face of Robotics
Maple Application Brief - Analyse the Path of a Liquid-Handling Robot
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055