Re: Viewing algebraic results
- To: mathgroup at smc.vnet.net
- Subject: [mg57715] Re: [mg57708] Viewing algebraic results
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 6 Jun 2005 04:21:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Milind,
You could use ??, OwnValues or Information.
f = x^2;
x = 2;
f
4
?? f
Global`f
f = x^2
OwnValues[f]
{HoldPattern[f] :> x^2}
Information[f]
Global`f
f = x^2
But, frankly, this is not terribly useful. You can't easily manipulate these
expressions. I would not assign a value to x if I wanted it also to be used
as a symbolic variable. In fact, I hardly ever assign values to single
letter symbols. It is just a cause of trouble and complication. Define
functions with arguments and then you can evaluate when necessary by filling
in a specific argument and still have the symbolic formula available.
Clear[f,x]
f[x_] := x^2
f[2]
f[x]
4
x^2
Or else use rules to substitute values.
f = x^2;
f /. x -> 2
4
and the general formula is still available. But I much prefer the f[x_]
definition to the f definition without arguments.
So my practice would be:
1) Use definitions with arguments and avoid argumentless definitions.
2) Never assign values to single character symbols.
3) Stay exact and symbolic as long as possible.
4) Use argument filling or rules to supply specific values, which usually
comes at or toward the end of a calculation.
It isn't absolutely necessary to follow these rules. It just saves a lot of
trouble. Other people on MathGroup may have their comments on this.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Milind Gupta [mailto:milind.gupta at gmail.com]
To: mathgroup at smc.vnet.net
Hello,
Is there a way to view the algebraic formulae for any variable defined
previously even if the variables in the formulae have been assigned a
numerical value?
Milind