Question: Defining functions within a proc/plotting within a loop

Hello there.

I´m fairly new to maple, so i apologize if this is a rather "simple" question, but right now I don´t really know how to get rid of the error message that occurs.

What I try to do is define 3 components of (in this case) a function that describes a magnetic field. These functions ( seen below) depend on a few parameters (a,b,c,d,p and chi).

restart:
with(plots)

>
> PlotMfield := proc (a::float, b::float, c::float, d::float, p::float, chi::float)

g := z -> c*(exp(-(1/2)*z^2/a^2)/a-exp(-(1/2)*z^2/b^2)/b)/sqrt(2*Pi) 
G :=z -> int(g(zeta), zeta = -infinity .. z)
f  := r -> d*exp(-p*r)
Bz := chi*p*(p-1/r)*G(z)*f(r);
Bphi := p*g(z)*f(r);
Br := chi*p*g(z)*f(r);
contourplot(sqrt(Br^2+Bphi^2+Bz^2), r = 0 .. 15, z = (-1)*2.5 .. 2.5, grid = [15, 75], scaling = constrained);
end proc;

this is what I get :


Warning, `g` is implicitly declared local to procedure `PlotMfield`
Warning, `G` is implicitly declared local to procedure `PlotMfield`
Warning, `f` is implicitly declared local to procedure `PlotMfield`
Warning, `Bz` is implicitly declared local to procedure `PlotMfield`
Warning, `Bphi` is implicitly declared local to procedure `PlotMfield`
Warning, `Br` is implicitly declared local to procedure `PlotMfield`
 


Although i DO get the contourplot, is there a better way to do this, especially a way without those warnings ? I tried to explicitly define them as local, but then I got a "could not parse"-error.

My second question is : is there a maximum for plots in a worksheet ? I would always get a single plot with for example  PlotMfield(0.5,0.55,1.0,1.0,0.4,1.0). What i try to do is to change every paramater a little bit and then look at the resulting plot.  Therefore i made a list of different values for every parameter, like La or Lc :

> La := [.5, .6, .7];
   Lc := [.9, .95, 1.0, 1.05, 1.1];

The  following line would give me an output of 3 different plots                          

>for i in La do PlotMfield (i,1.1*i,1.0,1.0,0.4,1.0) end do;

When i tried to combine a loop for a and a loop vor c (see below), maple would evaluate for a good amount of time, an then plot nothing at all.

for i in La do
   for j in Lc do PlotMfield (i,1.1*i,j,1.0,0.4,1.0) end do; end do;

 

So, if anybody has a good idea, or even just a hint or a link to the right documentation where i could read it up by myself, i would be grateful.

thank you for your time

Christian


p.s.: this is with maple 12 , worksheet mode, if that matters.


Please Wait...