# Question:Heat equation in 1 dimention - help needed

## Question:Heat equation in 1 dimention - help needed

Maple 13

I enclose Maple general solution to the PDF heat equation in 1 dimention.

I need corrections of it to enable me to calculate the heat equation in certain conditions :

du(x,t)/dt - d^2/x,t)/dx^2 = ;   t>0, x belongs to interval [0,phi[

with boundary conditions :

u(x,0) = sin(x)cos^2(x) ; x belongs to interval [0, phi)

u(0,t) = 0

u(phi,t) = 0  ;  t is still t>0

Heat equation

> restart:with(plots):with(plottools):

Heat equation in a rod in 1 dimention

> VL:=diff(u(x,t),t)-diff(u(x,t),x\$2);

> u:=(x,t)->sin(x)*cos^2*(x);

> with(plots):animate(plot, [u(x,t), x=0..Pi, thickness=2], t=0..4, frames=50);

Question 2 :

How to calculate Fourier coefficients n natural number i.e. n belongs to Z

for the function f(x) = sin(x)cos^2(x) on the onterval from - phi to phi.
How to do it ? Perhaps changes to this code :

Fourier series

Calculate and plot serial part sums for Fourier series given by function g1 and g2

on the interval for g1: [- ,0] and for g2 : [0, ].

Fouriercoefficients:

> c:=(n,g1,g2)->(2*Pi)^(-1)*int(g1*exp(-I*n*x), x=-Pi..0)+(2*Pi)^(-1)*int(g2*exp(-I*n*x), x=0..Pi);

﻿