MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Beginner, plot with multiple rules depending on parameters

  • To: mathgroup at
  • Subject: [mg83739] Beginner, plot with multiple rules depending on parameters
  • From: Francesco Mosconi <mosconi at>
  • Date: Thu, 29 Nov 2007 06:31:49 -0500 (EST)

I am a beginner user, and I am using Mathematica 5.0 on Windows XP. I 
would like to plot a function which is composed by three rules of the form:
if x < a => F[x] = f1
if a < x < b => F[x] = f2
The thing is slightly complicated by the fact that the function rules 
and the points of junction depend on several parameters and I don't know 
how to evaluate them correcly. I wrote the following code:

------------------Mathematica Code--------------------------------
First I clear all the variables, define the standard parameter 
substitution, define some constants.
Then I define the functions of g[f],cs[f],ss[f] and sp[f].
Finally I give the rules for the function F[f,s], which is formed by 
three parts, depending on the value of s.

stdpar = {A->50,CC->95,P->40};
kBT = 4.1;
c=kBT CC (2 Pi/3.6)^2;
p=kBT P (2 Pi/3.6)^2;
cs[f_]:=c*(1-CC/(4 A)*Sqrt[fc/f])
ss[f_]:=FullSimplify[1/cs[f]*Sqrt[2 p g[f]/(1-p/cs[f])]];
sp[f_]=FullSimplify[1/p*Sqrt[2 p g[f]/(1-p/cs[f])]];
F[f_,s_]:=-g[f]+1/2 cs[f] s^2 /;s < s[f]
F[f_,s_]:=FullSimplify[-g[f]/(1-p/cs[f])+Sqrt[2 p g[f]/(1-
     p/cs[f])]*s]/;ss[f]<s < sp[f]
F[f_,s_] := 1/2 p s^2 /; s > sp[f]


Here I just want to check that the functions of f evaluate correcly when 
all the standard parameters are substituted.


Now I would like to do the same for F, evaluating it for particular 
values of f and s


I define the function z[f,s] as minus the derivative of F with respect to f


And I would like to plot it for different values of  f and s.


------------------Mathematica Code--------------------------------

I must have got sumething wrong because the function F[f,s] does not 
evaluate to a number even when the /.stdpar rule is applied.
Can anyone suggest a solution?

Thank you very much


  • Prev by Date: Re: is the visibility of a Polygon[] exposed?
  • Next by Date: Re: FindInstance puzzler
  • Previous by thread: Re: How do I let them know about a bug ?
  • Next by thread: RE: Beginner, plot with multiple rules depending on parameters