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
Education
Support
My Adept
International |  About Us |  Blog |  Contact Us |  Press Room |  Jobs


The Next Steps

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

Learn More

Maple Home
Maple 13 Professional
Maple 13 Academic
Engineering

Maple 13 Academic Maths
Maple 13 Student Use
Maple 13 for High Schools
What's New in Maple 13
Maple History
Recorded Online Seminars
FREE Training Resources
Maple Application Briefs
Maple Adoption Program

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] FW: polynomials to operators

Search email archive for  

[MUG] FW: polynomials to operators
Author: Richard Patterson    Posted: Mon, 17 Feb 2003 17:18:28 -0500

>> From: Richard Patterson "rpatters"

----------
From: Richard Patterson <rpatters>
Date: Mon, 17 Feb 2003 15:22:29 -0500 (EST)
To: "helmut.kahovec" "fwchapma"
"devore" "sylvester7"
Cc: "rpatters"
Subject: polynomials to operators


Dear Fred, Helmut, Chris, Francis and now Carl,
Below is what I came up with after your many helpful suggestions.
My particular application uses homogeneous polynomials, so is
easier for that reason.
I admit to having a bias toward code that I completely understand.


> restart;
> f:=(x,y)->a*x^2+b*x*y+c*y^2;

2 2
f := (x, y) -> a x + b x y + c y

> g:=(x,y)->p*x^3+q*x^2*y+r*x*y^2+s*y^3;

3 2 2 3
g := (x, y) -> p x + q x y + r x y + s y

Procedure to change the coefficients of polynomials to constant functions.


> Change:=proc(f) local C:
> for C in coeffs(f(x,y),[x,y]) do assign(C,unapply(C,f)) end do;
> end proc;

Change := proc(f)
local C;
for C in coeffs(f(x, y), [x, y]) do
assign(C, unapply(C, f))
end do
end proc

This leaves me uneasy as it affects f even though the procedure returns
nothing. However the Changed polynomials can still be multiplied,
evaluated, differentiated just like ordinary polynomials.

> Test. This is how I know Change does something to f. There is no
other reason for this evaluation.

> f(x,y)(3);

2 2
a(3) x(3) + b(3) x(3) y(3) + c(3) y(3)

> Change(f);
> f(x,y)(3);

2 2
a x(3) + b x(3) y(3) + c y(3)



> Procedure to create an operator from a homogeneous polynomial:

> Operator:=proc(f) local i,j,n,DD;
> n:=degree(f(x,y),{x,y});
> DD:=0;
> for i from 0 to n do
> DD:=DD+coeff(coeff(f(x,y),x,i),y,n-i)*D[seq(1,j=1..i),seq(2,j=1..n-i)]
> od;
> RETURN(DD);
> end;

Operator := proc(f)
local i, j, n, DD;
n := degree(f(x, y), {x, y});
DD := 0;
for i from 0 to n do DD := DD +
coeff(coeff(f(x, y), x, i), y, n - i)*
D[seq(1, j = 1 .. i), seq(2, j = 1 .. n - i)]
end do;
RETURN(DD)
end proc

> Test:
> Operator(f);

c D[2, 2] + b D[1, 2] + a D[1, 1]

> Operator(f)(f)(x,y);

2 2 2
2 c + b + 2 a

> Operator(f)(g);

c ((x, y) -> 2 r x + 6 s y) + b ((x, y) -> 2 q x + 2 r y)

+ a ((x, y) -> 6 p x + 2 q y)

> Operator(f)(g)(x,y);

c (2 r x + 6 s y) + b (2 q x + 2 r y) + a (6 p x + 2 q y)

> It is also possible to define the operator before using Change.

> Operator(g);

s D[2, 2, 2] + r D[1, 2, 2] + q D[1, 1, 2] + p D[1, 1, 1]

> Operator(g)(g)(x,y);

6 s(g)(x, y) s + 2 r(g)(x, y) r + 2 q(g)(x, y) q + 6 p(g)(x, y) p

> Change(g);
> Operator(g)(g)(x,y);

2 2 2 2
6 s + 2 r + 2 q + 6 p

> Operator(g)(f)(x,y);

0

This was expected, since degree of g is bigger than degree of f.

Previous by date: [MUG] maple printing question, Maple User Group
Next by date: [MUG] differentiation of a sum, Maple User Group
Previous thread: [MUG] scope of `setoptions' command, Erik Leunissen
Next thread: [MUG] differentiation of a sum, Maple User Group



Ready to buy?

Maple Professional
Add to shopping basket
£ 1,695.00
Maple Professional - for concurrent use
Add to shopping basket
£ 3,385.00
MapleSim (requires Maple)
Add to shopping basket
£ 2,675.00
Maple & MapleSim Bundle
Add to shopping basket
£ 4,370.00

Featured Downloads

Maplesoft Engineering Suite Professional Brochure
Whats new in Maple 13 Professional datasheet
Maple Whitepaper: Making Sense out of Engineering Modeling and Mathematics
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper: Technological Superiority in Multi-Domain Physical Modelling and Simulation

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
adept

Top of the Page

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

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2010, Adept Scientific plc.
Site designed and maintained by Adeptise

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