|
[Date Index]
[Thread Index]
[Author Index]
Re: Putting an If in my function
- To: mathgroup at smc.vnet.net
- Subject: [mg101058] Re: [mg101039] Putting an If in my function
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Tue, 23 Jun 2009 07:03:32 -0400 (EDT)
- References: <200906220821.EAA09081@smc.vnet.net>
Hi,
I would suggest that you use pattern - matching instead of If:
Clear[fn];
fn[a_,g_,f_,x_,d_,w_]/;w==g:=d+a*f*x;
fn[a_,g_,f_,x_,d_,w_]:=
d (1+(Exp[g]-Exp[w])/f)^(f x)+(a (-1+(1+(Exp[g]-Exp[w])/f)^(f x))
f)/(Exp[g]-Exp[w]);
Regards,
Leonid
On Mon, Jun 22, 2009 at 1:21 AM, Lobotomy <labbman at gmail.com> wrote:
> Hi, this is my function
>
> #5 (1 + ((E^#2 - 1) - (E^#6 -
> 1))/#3)^(#3*#4) + (#1*((1 + (((E^#2 - 1) - (E^#6 -
> 1))/#3))^(#3*#4) -
> 1))/(((E^#2 - 1) - (E^#6 - 1))/#3) &[a, g, f, x, d, w]
>
>
> in the case when w==g the denominator equals zero.
>
> in this case i would like to rewrite the formula above to the much
> simpler
> d+a*n. How is this done? I've tried
>
> If[w == g, % = d + a*n], but this is not working. Another thing is
> where to put the "If"
>
>
Prev by Date:
Re: Re: Number format
Next by Date:
Re: Putting an If in my function
Previous by thread:
Putting an If in my function
Next by thread:
Re: Putting an If in my function
|