[Date Index]
[Thread Index]
[Author Index]
Re: unevaluated expression
*To*: mathgroup at smc.vnet.net
*Subject*: [mg77179] Re: unevaluated expression
*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
*Date*: Tue, 5 Jun 2007 06:44:39 -0400 (EDT)
*Organization*: The Open University, Milton Keynes, UK
*References*: <f40gan$628$1@smc.vnet.net>
juliok at verizon.net wrote:
> How do you write a function such as
> example[f_]:= ......
>
> so that when entering example[#^2] Mathematica will respond with
>
> integral_symbol x^2 dx = x^3 /3
>
> where integral_symbol is the standard math symbol, exponents are
> superscripts, etc. I tried Hold[], Unevaluated[], nothing seems to
> work.
>
> Thanks
>
>
> Julio
Hi Julio,
Assuming I have correctly understood what you tried to do, HoldForm is
the function you need on the LHS. For instance,
In[1]:=
HoldForm[Integrate[x^2, x]] == Integrate[x^2, x]
example[f_] := HoldForm[Integrate[f, x]] ==
Integrate[f, x]
example[x^2]
example2[fun_, var_:x] :=
HoldForm[Integrate[fun, var]] == Integrate[fun, var]
example2[x^3]
example2[(t - 3)^(1/2), t]
Out[1]=
3
2 x
Integrate[x , x] == --
3
Out[3]=
3
2 x
Integrate[x , x] == --
3
Out[5]=
4
3 x
Integrate[x , x] == --
4
Out[6]=
2 3/2
Integrate[Sqrt[-3 + t], t] == - (-3 + t)
3
Note that within a notebook, Integrate will be displayed as the integral
symbol. Also, example2 is more flexible than example.
Hope this helps,
Jean-Marc
Prev by Date:
**how to transform a list in a sequence of arguments?**
Next by Date:
**Segregating the elements of a list based on given lower and upper bounds**
Previous by thread:
**Re: unevaluated expression**
Next by thread:
**Re: unevaluated expression**
| |