Re: How to print TraditionalForm without evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg92620] Re: How to print TraditionalForm without evaluation
- From: "David Park" <djmpark at comcast.net>
- Date: Thu, 9 Oct 2008 06:32:24 -0400 (EDT)
- References: <gci1sm$iv$1@smc.vnet.net>
The following is probably the most common answer you will receive. To simplify things I have taken the TraditionalForm outside the the Grid. I have also used the new Version 6 iterator construction that allows us to list the specific substitutions. (It might have been simpler to use ex[1], ex[2] etc., to specify the examples and then iterate on the integer range.) Since the Integrate is in a HoldForm, we have to use a rule to substitute the iterated values. Grid[ {(* Do not integrate the first row *) Table[HoldForm[Integrate[integrand, x]] /. integrand -> expr, {expr, {ex1, ex2}}], (* Integrate the second row *) Table[Integrate[expr, x], {expr, {ex1, ex2}}]}, Frame -> All, ItemStyle -> Directive[FontSize -> 18, Bold]] // TraditionalForm With the Presentations package it is possible to use the command HoldOp, which holds an operation but evaluates the arguments. Then we could write the above more simply as: Needs["Presentations`Master`"] Grid[ {(* Do not integrate this *) Table[Integrate[expr, x] // HoldOp[Integrate], {expr, {ex1, ex2}}], (* Integrate this *) Table[Integrate[expr, x], {expr, {ex1, ex2}}]}, Frame -> All, ItemStyle -> Directive[FontSize -> 18, Bold]] // TraditionalForm Or if you use the Student's Integral part of Presentations you can write it even simpler using Integrate with a small 'i'. Grid[ {(* Do not integrate this *) Table[integrate[expr, x], {expr, {ex1, ex2}}], (* Integrate this *) Table[Integrate[expr, x], {expr, {ex1, ex2}}]}, Frame -> All, ItemStyle -> Directive[FontSize -> 18, Bold]] // TraditionalForm And if you want the students to actually practice doing integrals step-by-step using basic integration techniques and a BasicIntegralTable, such as students often work from, then the first integral could be done by the following commands: integrate[ex1, x] // TraditionalForm % // OperateIntegrand[Apart] // TraditionalForm % // BreakoutIntegral // TraditionalForm % // UseIntegralTable[BasicIntegralTable] // TraditionalForm There are also commands: ChangeIntegralVariable, IntegrateByParts and Trigonometric Substitute. You can also do definite integrals and obtain intermediate limit bracket expressions. A student can bypass the Mathematica Integrate command altogether using integral tables, or at some point the student can hand the integral over to Mathematica's Integrate or NIntegrate command. -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Serych Jakub" <Serych at panska.cz> wrote in message news:gci1sm$iv$1 at smc.vnet.net... >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 >