Robert M. Corless
Department of Applied Mathematics
University of Western Ontario
London, Canada

Copyright 2001 by Robert M. Corless
All rights reserved

Basics

Основы

Getting Started

Быстрый Старт

Sample Maple sessions  

Примеры сессий Maple

Third session - heat conduction by Fourier series Третья сессия - теплопроводность при помощи рядов Фурье

> restart;
> plots[setoptions](colour=black);
> I1 := int( sin(k*Pi*x)^2, x=0..1 );

I1 := -1/2*(cos(k*Pi)*sin(k*Pi)-k*Pi)/k/Pi

> I1 := eval( I1, {sin(k*Pi)=0, cos(k*Pi)=(-1)^k} );

I1 := 1/2

> I2 := int( x^2*(1-x^2)*sin(k*Pi*x), x=0..1);
> I2 := eval( I2, {sin(k*Pi)=0, cos(k*Pi)=(-1)^k} );

I2 := -2*(-12*(-1)^k+12+5*k^2*Pi^2*(-1)^k+k^2*Pi^2)...

> I2 := collect( I2, k, factor );

I2 := -2/Pi^3*(5*(-1)^k+1)/k^3+24*((-1)^k-1)/Pi^5/k...

> c := unapply( 2*I2, k );

c := proc (k) options operator, arrow; -4/Pi^3*(5*(...

> fn := n -> add( c(k)*sin(k*Pi*x), k=1..n );

fn := proc (n) options operator, arrow; add(c(k)*si...

> f5 := fn( 5 );

> plot( f5 - x^2*(1-x^2), x=0..1 );

> f10 := fn( 10 ):
> plot( f10 - x^2*(1-x^2), x=0..1 );

> un := n -> add( c(k)*exp(-k^2*Pi^2*t)*sin(k*Pi*x), k=1..n);

un := proc (n) options operator, arrow; add(c(k)*ex...

> u5 := un(5);

> diff( u5, t ) - diff( u5, x, x );

0

> u10 := un(10):
> diff( u10,t ) - diff( u10, x, x );

0

> plots[contourplot](u10, x=0..1, t=0..0.21, grid=[30,30], colour=black);

> restart:
> plots[setoptions](colour=BLACK);
> read "C:/books/ess/programs/fouriersine.mpl";
> macro(FSS=FourierSineSeries);

FSS

> f := FSS(x^2*(1-x^2),x);

f := proc (n) options operator, arrow; add(c(k)*sin...

> f5 := f(5);

> f10 := f(10):
> plot(f10-x^2*(1-x^2),x=0..1);

> f := FSS(cos(x),x);

f := proc (n) options operator, arrow; add(c(k)*sin...

> f15 := f(15):
> plot(f15-cos(x),x=0..1);

> restart;
> plots[setoptions](colour=black);
> FourierSineSeries2 := proc( f::operator )
local k, z;
description "FSS2(f::operator):"
" Improved Fourier series of f";
(n,x) -> add( limit( 2*int( sin(k*Pi*z)*f(z), z=0..1 ),k=j) * sin(j*Pi*x),j=1..n)
end proc;

FourierSineSeries2 := proc (f::operator) local k, z...

FourierSineSeries2 := proc (f::operator) local k, z...

FourierSineSeries2 := proc (f::operator) local k, z...

FourierSineSeries2 := proc (f::operator) local k, z...

> macro(FSS2=FourierSineSeries2);

FSS2

> FSS2( x^2*(1-x^2), x );
Error, invalid input: FourierSineSeries2 expects its 1st argument,f,

to be of type operator, but received x^2*(1-x^2)

> f := FSS2( x -> x^2*(1-x^2) );

> f5 := f( 5, x );

> fc := FSS2( x -> cos(Pi*x) );

> fc( 10, x );

8/3/Pi*sin(2*Pi*x)+16/15/Pi*sin(4*Pi*x)+24/35/Pi*si...

С официального разрешения                    © 2002 Waterloo Maple, Inc

 
Hosted by uCoz