Prev: "The requested evaluator is not currently defined"
Next: A problem with derivative InterpolatingFunction from NDSolve
From: DrMajorBob on 15 Dec 2008 07:48 The error message, which includes "1304.33[cf0_,cf1_,cf2_,cf3_,cf4_,cf5_]" tells us that npr already had a value (1304.33). It also tells us that the tags on Real values are protected. That is, you can't define a function called 1304.33. Bobby On Sun, 14 Dec 2008 06:41:01 -0600, stpatryck <stpatryck(a)gmail.com> wrote: > > > In[111]:= npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + > cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + > cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); > > (* Plan A NPV *) > npv[3600000, 0, 0, 0, 0, 7000000] > > SetDelayed::write: Tag Real in 1304.33[cf0_,cf1_,cf2_,cf3_,cf4_,cf5_] > is Protected. >> > > Out[111]:= 1304.33[3600000, 0, 0, 0, 0, 7000000] > -- DrMajorBob(a)longhorns.com
From: Jean-Marc Gulliet on 15 Dec 2008 07:50 stpatryck wrote: > In[111]:= npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + > cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + > cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); > > (* Plan A NPV *) > npv[3600000, 0, 0, 0, 0, 7000000] > > SetDelayed::write: Tag Real in 1304.33[cf0_,cf1_,cf2_,cf3_,cf4_,cf5_] > is Protected. >> > > Out[111]:= 1304.33[3600000, 0, 0, 0, 0, 7000000] The symbol 'npv' has already been assigned a value (a numeric value, 1304.22 in this case) so you must clear this value first. In[6]:= ClearAll[npv] npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); (*Plan A NPV*) npv[3600000, 0, 0, 0, 0, 7000000] Out[8]= 371988. Regards, -- Jean-Marc
From: michael.p.croucher on 15 Dec 2008 07:54
Hi If you start a clean session and only evaluate the two lines you posted then it works just fine: npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); npv[3600000, 0, 0, 0, 0, 7000000] Out[1]:= 371988. So there must be something wrong with the previous 110 lines of code in your notebook. Have you defined the variable npv elsewhere? The following reproduces your error in a clean session. Note that the only difference from the working code above is that I have set npv to be 1304.33 npv = 1304.33; npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); npv[3600000, 0, 0, 0, 0, 7000000] During evaluation of In[1]:= SetDelayed::write: Tag Real in 1304.33 [cf0_,cf1_,cf2_,cf3_,cf4_,cf5_] is Protected. >> Out[3]= 1304.33[3600000, 0, 0, 0, 0, 7000000] Hope this helps, Mike www.walkingrandomly.com On 14 Dec, 12:40, stpatryck <stpatr...(a)gmail.com> wrote: > In[111]:= npv[cf0_, cf1_, cf2_, cf3_, cf4_, cf5_] := -(cf0) + > cf1*(1/((1.12)^1)) + cf2*(1/((1.12)^2)) + cf3*(1/((1.12)^3)) + > cf4*(1/((1.12)^4)) + cf5*(1/((1.12)^5)); > > (* Plan A NPV *) > npv[3600000, 0, 0, 0, 0, 7000000] > > SetDelayed::write: Tag Real in 1304.33[cf0_,cf1_,cf2_,cf3_,cf4_,cf5_] > is Protected. >> > > Out[111]:= 1304.33[3600000, 0, 0, 0, 0, 7000000] |