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: [mg114776] Re: Displaying Equations Symbolically and Numerically
  • From: Jon McLoone <jonm at wolfram.co.uk>
  • Date: Thu, 16 Dec 2010 05:51:51 -0500 (EST)
  • References: <ieadkv$r9h$1@smc.vnet.net>

On Dec 15, 12:51 pm, Gregory Lypny <gregory.ly... at videotron.ca> 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


Try

ShowSubstitution[expr_, values_] :=  Row[{TraditionalForm[expr], " =
", HoldForm[expr] /. values, " = ",    expr /. values, " = ",
N[expr /. values]}]

Then, for example...

ShowSubstitution[ Sqrt[x^(a + b)] + c Log[d/e], {a -> 2, b -> 3, c ->
5, d -> 8,  e -> 2, x -> 5}]

You could then wrap manipulate around with

Manipulate[
ShowSubstitution[ Sqrt[x^(a + b)] + c Log[d/e], {a -> aval, b -> 3, c -
> 5, d -> 8,  e -> 2, x -> 5}],
{aval,1,10,1}]


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