[Date Index]
[Thread Index]
[Author Index]
Re: Newbie question
*To*: mathgroup at smc.vnet.net
*Subject*: [mg54209] Re: [mg54177] Newbie question
*From*: "David Annetts" <davidannetts at aapt.net.au>
*Date*: Sun, 13 Feb 2005 00:21:40 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
Hi Torben,
> I use the Mathematica package below. The function that I call
> is HestonVanilla. This function has 13 arguments that I need
> to provide. I want to change the programm, so that I do not
> have to give "lambda", "rf", "cp"
> and "G" each time I use the function. Instead I want that
> these arguments are always set to specific values, namely:
> lambda = 0
> rf =0
> cp = 1
> G = 0
<Snippage>
You have at least two options.
The first is to provide an alternate definition for HestonVanilla like
HestonVanilla[k,o,sigma,rho,r,v,S,K,tau] =
HestonVanilla[k,o,sigma,rho,0,r,0,v,S,K,tau,1,1]. For your purposes, this
might be the way to go.
The second is to provide default values for each parameter as in
HestonVanilla[k,o,sigma,rho,lambda:0,r,rf:0,v,S,K,tau,cp:1,G:0] := Module[
...
];
Is there any reason why you use global variables in your function
definition? Normally (eg 2.7.1 of The Book), you'd define a function like
HestonVanilla[k_,o_,sigma_,rho_,lambda_:0,r_,rf_:0,v_,S_,K_,tau_,cp_:1,G_:0]
Regards,
Dave.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/02/2005
Prev by Date:
**Re: finding package in ExtraPackages`Enhancements`**
Next by Date:
**Re: Importing binary file is toooooo slow...**
Previous by thread:
**Re: Newbie question**
Next by thread:
**Re: Newbie question**
| |