Re: Different letters different solutions!!
- To: mathgroup at smc.vnet.net
- Subject: [mg36718] Re: Different letters different solutions!!
- From: Erich Mueller <emueller at mps.ohio-state.edu>
- Date: Fri, 20 Sep 2002 04:16:36 -0400 (EDT)
- Organization: Ohio State University
- References: <email@example.com>
- Sender: owner-wri-mathgroup at wolfram.com
Neither of your solutions are "wrong" according to your rules. Lets step through them In:=integrate[f Exp[-0.8316*tau], t] The function Times is Orderless, so the kernel rewrites the integrand in lexographical (sp) order as In:=integrate[Exp[-0.8316*tau] f, t] It then applies rule 1: integrate[c_ y_,t_]:=c*integrate[y,t]/;FreeQ[c,t] Well, The term "Exp[-0.8316*tau]" contains no "t", so according to your rule it is equal to Exp[-0.8316*tau] integrate[f, t] At this point none of your rules apply, so the kernel stops. When you use "a" instead of "f" the ordering of the "constant" and the exponential are reversed, and you get the behaviour that you actually desired. A simple fix is to replace the condition in rule 1 by FreeQ[c,t]&&FreeQ[c,tau] You may however want to think carefully about exactly what you want your function "integrate" to do. For example, with the rules given, the variable "t" and the variable "tau" seem to be playing the same role. Cheers, Erich On Thu, 19 Sep 2002 guillerm at usal.es wrote: > I have defined two functions (Math 4.1) > In:= integrate[c_ y_,t_]:=c*integrate[y,t]/;FreeQ[c,t]; > In:= integrate[Exp[(a_.)*tau], t_]:=(E^(a*t)-1)/a/; > FreeQ[a,t]&&FreeQ[a,tau]; > > when I applied these functions the solution is different if the coefficient is > the letter d or lower (solution fine) or f or higher (solution wrong) . Here is > an example: > > Using letter f > In:=integrate[f Exp[-0.8316*tau], t] > > Out:=integrate[f, t]/E^(0.8316*tau) (*wrong*) > > Using letter a (the solution is rigth > > In:=integrate[a Exp[-0.8316*tau], t] > > Out:=-1.20250*a*(-1 + E^(-0.8316*t)) > > What it wrong? > > Guillermo > Sanchez > > --------------------------------------------- > This message was sent using Endymion MailMan. > http://www.endymion.com/products/mailman/ > > > >