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] differental operators

Search email archive for  

[MUG] differental operators
Author: Richard Patterson    Posted: Tue, 11 Feb 2003 10:26:00 -0500

>> From: Richard Patterson />
I want to define differential operators and test them on
a polynomial f(x,y):

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

If the differential operator has constant coefficients

> op1:=2*D[1]+3*D[2];

op1 := 2 D[1] + 3 D[2]

then everything works fine:

> op1(f)(x,y);

4 a x + 2 b y + 3 b x + 6 d y

How do I accomplish the same thing if the coefficients are
unspecified constants?

> op2:=c*D[1]+d*D[2];

op2 := c D[1] + d D[2]

> op2(f)(x,y);

c(f)(x, y) (2 a x + b y) + d(f)(x, y) (b x + 2 d y)

It was no help to include

> assume(c,constant): assume(d,constant):

> op2(f)(x,y);
c~(f)(x, y) (2 a x + b y) + d~(f)(x, y) (b x + 2 d~ y)



[MUG] differental operators
Author: Maple User Group    Posted: Mon, 17 Feb 2003 22:05:23 -0500

>> From: Maple User Group />
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 13 Feb 2003 09:41:53 -0500 (EST)
From: Fred Chapman /> To: /> Subject: differental operators

On Tue, 11 Feb 2003, Richard Patterson wrote:

> >> From: Richard Patterson /> >
> I want to define differential operators and test them on
> a polynomial f(x,y):
>
> f:=(x,y)->a*x^2+b*x*y+d*y^2;
> 2 2
> f := (x, y) -> a x + b x y + d y
>
> If the differential operator has constant coefficients
>
> > op1:=2*D[1]+3*D[2];
>
> op1 := 2 D[1] + 3 D[2]
>
> then everything works fine:
>
> > op1(f)(x,y);
>
> 4 a x + 2 b y + 3 b x + 6 d y
>
> How do I accomplish the same thing if the coefficients are
> unspecified constants?


The simplest reliable solution that I found for your problem is to define
`c` and `d` to be constant functions:


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

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

> op2:=c*D[1]+d*D[2];

op2 := c D[1] + d D[2]

> op2(f)(x,y);

c(f)(x, y) (2 a x + b y) + d(f)(x, y) (b x + 2 d y)

> c := (f::anything) -> c;

c := f::anything -> c

> d := (f::anything) -> d;

d := f::anything -> d

> op2(f)(x,y);

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


If you like, you can assign numerical values to `c` and `d` afterwards:


> c := 2: d := 3: op2(f)(x,y);

4 a x + 2 b y + 3 b x + 18 y


With best wishes,

Fred Chapman


NOTE: In anticipation of obtaining my Ph.D. this June, I'm now using my
new, permanent, lifetime e-mail address: />
---------------- http://www.scg.uwaterloo.ca/~fwchapma/ ----------------

Frederick W. Chapman, Ph.D. Student UW Office: Math & Computer 5162
Department of Applied Mathematics UW Phone: (519) 888-4567 x6672
University of Waterloo
Waterloo, Ontario, N2L 3G1, Canada Curriculum Vitae: see homepage


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

Date: Thu, 13 Feb 2003 22:02:23 +0100
From: Helmut Kahovec /> To: /> Subject: differental operators

Richard Patterson wrote:

>| I want to define differential operators and test them on
>| a polynomial f(x,y):
>|
>| f:=(x,y)->a*x^2+b*x*y+d*y^2;
>| 2 2
>| f := (x, y) -> a x + b x y + d y
>|
>| If the differential operator has constant coefficients
>|
>| > op1:=2*D[1]+3*D[2];
>|
>| op1 := 2 D[1] + 3 D[2]
>|
>| then everything works fine:
>|
>| > op1(f)(x,y);
>|
>| 4 a x + 2 b y + 3 b x + 6 d y
>|
>| How do I accomplish the same thing if the coefficients are
>| unspecified constants?
>|
>| > op2:=c*D[1]+d*D[2];
>|
>| op2 := c D[1] + d D[2]
>|
>| > op2(f)(x,y);
>|
>| c(f)(x, y) (2 a x + b y) + d(f)(x, y) (b x + 2 d y)


Well, you may use an extension to evalapply() as shown below.

> restart;
> type(1,procedure);

false

> 1(f);

1

> 1(f)(x,y);

1

> type(u,procedure),type(v,procedure);

false, false

> u(f),v(f);

u(f), v(f)

> u(f)(x,y),v(f)(x,y);

u(f)(x, y), v(f)(x, y)

> ConstOperator:=proc() op(0,args[1]) end proc:
> `evalapply/u`:=eval(ConstOperator):
> `evalapply/v`:=eval(ConstOperator):
> type(u,procedure),type(v,procedure);

false, false

> u(f),v(f);

u(f), v(f)

> u(f)(x,y),v(f)(x,y);

u, v <===!!!===

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

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

> op1:=2*D[1]+3*D[2];

op1 := 2 D[1] + 3 D[2]

> op1(f)(x,y);

4 a x + 2 b y + 3 b x + 6 c y

> op2:=u*D[1]+v*D[2];

op2 := u D[1] + v D[2]

> op2(f)(x,y);

u (2 a x + b y) + v (b x + 2 c y)

> eval(%,{u=2,v=3});

4 a x + 2 b y + 3 b x + 6 c y


Kind regards,

Helmut


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

Date: Sat, 15 Feb 2003 04:25:19 -0500 (EST)
From: Carl Devore /> To: /> Subject: differental operators



On Tue, 11 Feb 2003, Richard Patterson wrote:
> I want to define differential operators and test them on
> a polynomial f(x,y):
> f:=(x,y)->a*x^2+b*x*y+d*y^2;
> If the differential operator has constant coefficients
> > op1:=2*D[1]+3*D[2];
> then everything works fine:
> > op1(f)(x,y);
> 4 a x + 2 b y + 3 b x + 6 d y
>
> How do I accomplish the same thing if the coefficients are
> unspecified constants?
> > op2:=c*D[1]+d*D[2];
> > op2(f)(x,y);
> c(f)(x, y) (2 a x + b y) + d(f)(x, y) (b x + 2 d y)

You need to make the coefficients operators at the same level as the D's.
Numbers are automatically operators, but names are not.

> op2:= (()->()->c)*D[1] + (()->()->d)*D[2];



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

From: "Dr Francis J. Wright" /> To: /> Subject: differental operators
Date: Sat, 15 Feb 2003 18:43:50 -0000

From: "Richard Patterson" /> To: /> Sent: Tuesday, February 11, 2003 3:26 PM
Subject: [MUG] differental operators


> I want to define differential operators and test them on
> a polynomial f(x,y):
>
> f:=(x,y)->a*x^2+b*x*y+d*y^2;
> 2 2
> f := (x, y) -> a x + b x y + d y
>
> If the differential operator has constant coefficients
>
> > op1:=2*D[1]+3*D[2];
>
> op1 := 2 D[1] + 3 D[2]
>
> then everything works fine:
>
> > op1(f)(x,y);
>
> 4 a x + 2 b y + 3 b x + 6 d y
>
> How do I accomplish the same thing if the coefficients are
> unspecified constants?
>
> > op2:=c*D[1]+d*D[2];
>
> op2 := c D[1] + d D[2]
>
> > op2(f)(x,y);
>
> c(f)(x, y) (2 a x + b y) + d(f)(x, y) (b x + 2 d y)


Maple is treating c and d as mappings, so one solution is explicitly to
define them to be constant mappings, i.e. mappings that evaluate to their
own names when they are applied, regardless of their arguments. This is
essentially what Maple does automatically for numbers, which is why your
explicit example worked.

> c := proc() 'procname' end proc;

c := proc() 'procname' end proc

> d := eval(c);

d := proc() 'procname' end proc

> op2(f)(x,y);

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

Francis


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

Date: Mon, 17 Feb 2003 17:01:43 -0500 (EST)
From: Carl Devore /> To: /> Subject: differential operators



Please CC all articles to the mailing-list. If that is unacceptable to
you, then this is my last article on this subject. Let others benefit
from these writings.

On Mon, 17 Feb 2003, Richard Patterson wrote:
> > f:=(x,y)->a*x^2+b*x*y+c*y^2;
> > g:=(x,y)->p*x^3+q*x^2*y+r*x*y^2+s*y^3;
>
> 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;
>
> This leaves me uneasy as it affects f even though the procedure returns
> nothing.

Worse than that, it affects the coefficients. Here is how to get it to
returned the modified polynomial without any side effects:

Change:= (f, V)->
unapply(subsindets(f(V[]), name, N-> `if`(N in V, N, unapply(N))), V[])
;

And the call becomes
F:= change(f, [x,y]);

I chose to use a different name, F, but you re-use f if you want.
It is best not to rely on there being 2 variables, so I pass in the
variable names. We can get around that if you insist on not passing in
the variable names.

The above uses the Maple 8 feature `in`. You can retrofit it to Maple 7
by using member. susbindets is a feature of Maple 7. We can go back
further than that if you need.

> However the Changed polynomials can still be multiplied,
> evaluated, differentiated just like ordinary polynomials.

diff works on them, but there is a bug that prevents D from working on
them. The coefficient functions are changed to simply t. This affects at
least Maple 6 and Maple 8.



Previous by date: [MUG] Re: DegreeReverseLexicographic Monomial ordering, Allan Wittkopf
Next by date: [MUG] Re: Generating a compound poission process in Maple, Robert Israel
Previous thread: [MUG] simple question: numbering equations and/or lines in worksheet?,  Clearthink
Next thread: [MUG] Generating a compound poission process in Maple, Theo H S Boafo



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