Re: How to print TraditionalForm without evaluation

• To: mathgroup at smc.vnet.net
• Subject: [mg92641] Re: How to print TraditionalForm without evaluation
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Thu, 9 Oct 2008 06:36:21 -0400 (EDT)
• References: <gci1sm\$iv\$1@smc.vnet.net>

```Serych Jakub wrote:
> I want to write notebook which prints simple integration examples with
> results for the students.
> Something like:
>
> ex1 = (1 - 3*x^3 + 2*x^5)/(4*x^3);
> ex2 = (-5*x^(1/4) + (x^2)^(4/3))/x^(3/2);
>
> Grid[{
>   Table[
>    TraditionalForm[Integrate[Symbol["ex" <> ToString[nr]], x]], {nr, 1, 2}],
> (* do not integrate this *)
>   Table[
>    TraditionalForm[Integrate[Symbol["ex" <> ToString[nr]], x]], {nr, 1, 2}]},
> (* integrate this *)
>  Frame -> All, ItemStyle -> Directive[FontSize -> 18, Bold]]
>
> (there will be much more examples ex3,ex4, etc.)
>
> This works nice, but I need to tell Mathematica not to Integrate in the first
> row of the table - examples (only in the second one - results). Is there  any
> possibility to suppress the evaluation of the Integral in the first row of
> the grid and just print the symbol of Integral and the TraditionalForm of the
> example behind it?
>
> May be this is a newbie kind of question, but I have spent lot of time on it,
> and I cannot solve it.
>
> Thanks in advance for any help
>
> Jakub
>
HoldForm prevents evaluation, but your requirements are slightly more
complicated because you do need to obtain the value of ex1, etc. I
expect you have already encountered that gotcha! Here is some code that
works, and also eliminates the clumsiness of constructing symbols just
in order to access a list of things:

ex = (1 - 3*x^3 + 2*x^5)/(4*x^3);
ex = (-5*x^(1/4) + (x^2)^(4/3))/x^(3/2);

Grid[{Table[
With[{exx = ex[nr]}, HoldForm[Integrate[exx, x]]]], {nr, 1,
2}],(*do not integrate this*)
Integrate[Symbol["ex" <> ToString[nr]], x]], {nr, 1,
2}]},(*integrate this*)Frame -> All,
ItemStyle -> Directive[FontSize -> 18, Bold]]

Notice that the 'With' construct injects the value of ex[nr] inside the
HoldForm construction, but the HoldForm still prevents further
evaluation - which is exactly what you want.

David Bailey
http://www.dbaileyconsultancy.co.uk

```

• Prev by Date: Re: Overlapping binning of differences of two lists
• Next by Date: Re: Finding the optimum by repeteadly zooming on the solution space
{"ft_lang_label":"__label__en","ft_lang_prob":0.8224384,"math_prob":0.8994745,"size":2269,"snap":"2019-51-2020-05","text_gpt3_token_len":667,"char_repetition_ratio":0.11302428,"word_repetition_ratio":0.08055556,"special_character_ratio":0.3287792,"punctuation_ratio":0.1557562,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9641842,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-05T14:28:51Z\",\"WARC-Record-ID\":\"<urn:uuid:1f0aaeec-e7d1-4c45-ac54-db778e4974e7>\",\"Content-Length\":\"46181\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:049ceaa8-ef44-4c73-ad07-ab19d8317451>\",\"WARC-Concurrent-To\":\"<urn:uuid:4bdf3915-6731-4b14-9c2b-22b522ae12b2>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"http://forums.wolfram.com/mathgroup/archive/2008/Oct/msg00187.html\",\"WARC-Payload-Digest\":\"sha1:NN327PUBGQ4W5LQTVYOXYB7UWV4HOMOR\",\"WARC-Block-Digest\":\"sha1:JLX7ZLPL2ASV7EVBVCYJRTIAJC2XKZQW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540481076.11_warc_CC-MAIN-20191205141605-20191205165605-00370.warc.gz\"}"}