Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: How to change the argument of a function?


  • To: mathgroup@smc.vnet.net
  • Subject: [mg10832] RE: [mg10783] How to change the argument of a function?
  • From: Jean-Marie THOMAS <jmthomas@cybercable.tm.fr>
  • Date: Tue, 10 Feb 1998 21:01:44 -0500
  • Return-Receipt-To: Jean-Marie THOMAS <jmthomas@cybercable.tm.fr>

Try:
f[x_]:=x+1;
and set the new value for x:
x=f[x]

Comment: is it the old problem in Pascal or C: passing a parameter by 
address or by value? I am not sure of this, but I feel Mathematica
copies  all the input parameters, but keeps for these the same name.

Hope this helps,
-----------------------------------------------

Jean-Marie THOMAS
Conseil et Audit en Ingenierie de Calcul jmthomas@cybercable.tm.fr
+33 (0)3 88 32 93 64
www.cybercable.tm.fr/~jmthomas
=======================


-----Message d'origine-----
De:	Vilis Nams [SMTP:vnams@nsac.ns.ca] Date:	jeudi 5 fevrier 1998 06:58
A:	mathgroup@smc.vnet.net
Objet:	[mg10783] How to change the argument of a function?

I want to define a function that in the course of doing something, also
changes the value of its argument, for example: f[x_]:=Module[{},
x=2*x;
x
]
When I run the function, I get the error: "Set::setraw : Cannot assign
to raw object  ...." Can this be done in some way?


--------------------
Vilis O. Nams
Dept of Biology, NSAC
Box 550, Truro, NS,  Canada
vnams @ nsac.ns.ca
-------------------




  • Prev by Date: Re: PDEs & Mathematica.
  • Next by Date: Re: optimize
  • Prev by thread: Re: How to change the argument of a function?
  • Next by thread: Re: Re: How to change the argument of a function?