Question: problem with passing some parameters while plotting functions

Hi

The following is a section of my codes:

> EV := {seq(w[i] = q*Eg[i]/h, i = 1 .. n)}; X := {seq(x[i], i = 1 .. n)};

> SX := proc (egx, egy)::set; local j, sx, SEqn, counter, ev; global Eg; Digits := 30; counter := 1; for j to n do if type(Eg[j], name) and counter = 1 then Eg[j] := egx; counter := 2 elif type(Eg[j], name) and counter = 2 then Eg[j] := egy end if end do; SEqn := {seq(evalf(subs(EV, Eqn(i))), i = 1 .. n)}; sx := fsolve(SEqn, X) end proc;
> Eg := [Eg1, Eg2, 0, 0, 0];

Temperatures in K.

> Ts := 6000; Tc := 300;

> PCellMax := sum(k*Tc*x[i]^2*exp(x[i])*F0(i), i = 1 .. n);
> PInc := 2*Pi^5*(k*Ts)^4*C*fw*A/(15*h^3*c^2);

> trace(SX);
                               SX
> PEff := proc (Egx, Egy) 100*evalf(subs(EV, SX(Egx, Egy), PCellMax/PInc)) end proc;
> contourplot(PEff(Eg1, Eg2), .2 .. 3, .2 .. 3);

 

Well, i'm trying to plot PEff vs Eg1 and Eg2.  The problem i believe is with the function SX().  For given set of Eg1 and Eg2, SX() is suppose to solve for x[i] from a set of equations in SEqn.  I've tried to work with Eg[i] as a global list rather than passing it on to SX() as an argument, but SX() doesn't quite register.  I've used the trace command and found that plot function tries to get an expression from PEff in terms of Eg1 and Eg2 before throwing the numbers from the specified range into SX().  So SX() is not able to solve for the set of x[i] and the subs call in PEff is giving an error msg.  any suggestions?

My maple entire file is here for your info: http://www.mapleprimes.com/viewfile/4384.

MUCH APPRECIATED!

Please Wait...