Re: SetDelayed::write ... [x_] is protected
- To: mathgroup at smc.vnet.net
- Subject: [mg97917] Re: [mg97863] SetDelayed::write ... [x_] is protected
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 25 Mar 2009 05:46:30 -0500 (EST)
- Reply-to: hanlonr at cox.net
sol = {{i1 -> 220/x}, {i2 -> 100 + x}};
myfun[x_] = 50*i1 + 2*i2 /. Flatten[sol]
2*(x + 100) + 11000/x
Bob Hanlon
On Tue, Mar 24, 2009 at 7:46 AM , Serych Jakub wrote:
> Dear M users,
> I have solution of equations which is dependend on one parameter lets
> say:
> sol={{i1->220/x}, {i2 -> 100+x}} and I need to define function based
> on this
> solution with the x as argument lets say: myfun[x_]:=50*220/x + 2
> (100+x);
>
> I'm trying to do it like this:
>
> myfun[x_]:=50 * i1 + 2 * i2 /. sol
>
> But it prints the error message: "SetDelayed::write ... [x_] is
> protected".
>
> Does anybody know what's the problem and how to define such function?
>
> Thanks in advance
>
> Jakub