Re: Drawing function with 3 variables in a graph
- To: mathgroup at smc.vnet.net
- Subject: [mg71971] Re: Drawing function with 3 variables in a graph
- From: albert <awnl at arcor.de>
- Date: Wed, 6 Dec 2006 06:04:04 -0500 (EST)
- Organization: Arcor
- References: <ekmefu$8hs$1@smc.vnet.net><ekp4ie$2al$1@smc.vnet.net> <el3k2l$r0i$1@smc.vnet.net>
Hi, > I guess my problem is still this: > With[{m=100, a = 1}, Plot{ f[x,m], {x,-5,5}]] > > f contains several smaller functions, which uses a as their variable. > But it doesn't seem like the variable a is passed on to the functions > inside f[x,m]... no, this is how With works: it literally replaces all occurances of m and a in Plot{ f[x,m], {x,-5,5}]. There is no a in that expression, so you could just as well omit the a=1 in this expression... > I had hoped that this would set a = 1 and m=100, and then calculate the > rest with x varying from -5 to 5. If you want this, you will need Block, which _does_ set a to 1 and all functions called from f should be using that value, too (at least if a is not one of their "arguments"). Note that Module would not work either, since it makes a new a (a$<somenumber> to be precise) which is different from the a used in your other function definitions... try this: Block[{m=100,a=1},Plot[f[x,m],{x,-5,5}] hth, albert