Legal Notice, Disclaimer, and Book Ordering Information:

(* Legal Notice, Disclaimer, and Book Ordering Information:

Last Modified: FIO January 1, 1995

Mathematica For Physics
Robert L. Zimmerman and Fredrick I. Olness
MathSource Number: 0206-862 

ISBN 0-201-53796-6
For ordering information, call 1-800-822-6339
Addison-Wesley Publishing Company

Communication with the authors:
Fredrick I. Olness:  olness@mail.physics.smu.edu
Robert L. Zimmerman: bob@zim.uoregon.edu

Copyright 1995, Addison-Wesley Publishing Company, Inc. The material in
this file may be distributed freely  so long as the content remains
unchanged, and the copyright and  reference notices are included. The
publisher grants permission for the noncommercial use of these programs
and program segments.  All other uses require the prior written consent
of the publisher.    

All rights are reserved with regard to the  material in the
"Mathematica For Physics" text, and may not be reproduced, stored in a
retrieval system, or transmitted,  in any form or by any means,
electronic, mechanical, photocopying,  recording, or otherwise, without
the prior written permission  of the publisher. 

The programs and applications presented in this book have been included
for  their instructional value. They have been tested with care but are
not  guaranteed for any particular purpose. The publisher does not
offer any  warranties or representations, nor does it accept any
liabilities with  respect to the programs or applications. 

 *)

Chapter 5, Section 2, Problem 5:   
 Conducting Cylinder with a Potential on the Surface

<<mainDir:subDir:ch5init.m  (* Mac  Version *)

<<mainDir/subDir/ch5init.m  (* Unix Version *)

Solution

Clear["Global`*"];

termIn[m_]= A[m] (r/r0)^m Sin[m phi]

potIn[n_]:= Sum[ termIn[m] ,{m,1,n}]

eq1= V[phi] == termIn[m] /.{r->r0}

rhs= ( Integrate[ eq1[[2]] Sin[m phi] ,{phi,0,2 Pi}]
        //.{Sin[4 m Pi]->0}
      )

lhs=(  ( Integrate[ +V0 Sin[m phi] ,{phi, 0,1 Pi}] 
       + Integrate[ -V0 Sin[m phi] ,{phi,Pi,2 Pi}] 
     ) //.{Cos[m Pi]-> (-1)^m, Cos[2 m Pi]-> 1} 
       //Simplify
    )

aSol= Solve[rhs==lhs,A[m]][[1]] //Simplify;
A[m_]= A[m] /. aSol

potIn[n]

termOut[m_]= A[m] (r0/r)^m Sin[m phi]

potOut[n_]:= Sum[ termOut[m] ,{m,1,n}]
potOut[n]

values={r0->1, V0->1};

Clear[pot];
pot[n_,x_ /; x<1 ]:=potIn[ n];
pot[n_,x_ /; x>=1]:=potOut[n];

Plot[Table[ pot[20,r/r0] //.values,{r,0,1,0.2}] //Evaluate
 ,{phi,0,2Pi}];

Plot[Table[ pot[20,r/r0] //.values,{r,1,2,0.2}] //Evaluate
 ,{phi,0,2Pi}];

CylindricalPlot3D[ pot[20,r/r0] //.values
  ,{r,0,3}
  ,{phi,0,2Pi}
  ,BoxRatios->{1,1,1}
  ,ViewPoint->{4, -2, 0}
  ];