Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Displaying Equations Symbolically and Numerically

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114757] Re: Displaying Equations Symbolically and Numerically
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Thu, 16 Dec 2010 05:47:49 -0500 (EST)
  • References: <ieadkv$r9h$1@smc.vnet.net>

On 15/12/10 12:51, Gregory Lypny wrote:
> Hello everyone,
>
> I would like to be able to display equations for my students in symbolic
> form on the left side and with the numbers plugged in on the right side
> but am not quite sure how to do it programmatically.  Suppose my
> equation in "symbolic" form is
>
> 	sqrt(x^(a+b)) + c ln(d/e)
>
> I know I can make it look like real math by having it displayed as
> TraditionalForm.  However, I also want to display the solution with
> particular values for the variable x and the parameters a, b, c, d, and
> e slotted in, something like
>
> 	sqrt(x^(a+b)) + c ln(d/e) = sqrt(9^(2+1)) + 4 ln(32/8) = answer
>
> to recognize that some students may be a little rusty at simplifying on
> the fly.   Wrapping the whole package in Manipulate would put the icing
> on the cake.
>
> Any tips on how apply the appropriate styles would be most appreciated.
>
> Regards,
>
> Gregory
>
>
>
Your question is a little vague (I don't see where Manipulate might come 
in), but presumably it is the middle expression that you have difficulty 
with - because it is partially evaluated. The easiest way to obtain it, 
is to perform the substitutions on the expression wrapped in HoldForm.

HoldForm[sqrt (x^(a + b)) + c ln (d/e)] /. {9 -> 9, a -> 2, b -> 1,
   c -> 4, d -> 32, e -> 8}

You can then remove the HoldForm, with for example expr/.HoldForm->Identity

The general problem of making Mathematica follow the steps that a person 
might have used in a hand calculation, is much more difficult, however. 
Mathematica often uses quite exotic methods to solve (for example) 
integrals, and anyway these intermediate steps are not displayed.

David Bailey

http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: manipulate time
  • Next by Date: Re: manipulate time
  • Previous by thread: Re: Displaying Equations Symbolically and Numerically
  • Next by thread: Re: Displaying Equations Symbolically and Numerically