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

MathGroup Archive 2011

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

Search the Archive

A couple of questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122223] A couple of questions
  • From: "Feinberg, Vladimir" <13vladimirf at students.harker.org>
  • Date: Fri, 21 Oct 2011 06:24:37 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <CAAW96o6gjBkriNiW3eUqk+CWo8wwg_BOY=+bG7cWhWPZ3i7CQQ@mail.gmail.com>

 Hello,

    My name is Vlad, and I (erroneously) contacted the consultation
    center for Mathematica instead of you--they gave me some quick answers only.

    I first was acquainted with Mathematica in my PreCalc class, and have been>>    using it ever since.  I think it is an excellent tool, especially
    for its ability to create didactic visualizations.  I had some
    questions about Mathematica:

    As a Calculus tutor, I wanted to provide my peers with a visual
    understanding to the "disk" method of calculating volume for
    functions rotated around the x or y axes.  All of the online
    demonstrations were very well formatted and looked sharp, but I
    wanted the students to be able to input their own functions, so I
    made my own Mathematica notebook (attachments).  Is it possible to input a>>    Solve function, looking for x in terms of y, instead of asking for
    the inverse?  Every time I did so, my graphs ended up replacing the
    variable that was being solved for with the variables being plotted
    in 3D.

    Also, I only have a vague concept of pure functions, and didn't
    really understand their purpose or how they work.  How are they
    different from regular functions?  When I saw them being used, they
    were really no different than, say, a Table function.

    Thanks for the help,
    Vlad

Here is my Mathematica code:

lb[x_] = Lighter[Blue, x];
text[x_] = Style[x, Red, 15, Bold];

DynamicModule[
 {func = x^2, mindom = -.1, dom = Sqrt[2.], minydom = -2, ydom = 2,
  xtrue = True, mesh = None, funcy = Sqrt[y], cyl = 3, vol = True,
  a = 2., b = 4.},
 Panel[Grid[{{Grid[{{
        Grid[{{Text["  f(x)"], InputField[Dynamic[func]]},
          {Text["  \!\(\*SuperscriptBox[\(f\), \(-1\)]\)(y)"],
           InputField[Dynamic[funcy]]},
          {Text[" x-Range"],
           Grid[{{
              Slider[Dynamic[mindom], {-2 Pi, -1*^-5},
               ImageSize -> 100],
              Slider[Dynamic[dom], {1*^-5, 2 Pi},
               ImageSize -> 100]}}]},
          {Text[" y-Range"],
           Grid[{{Slider[Dynamic[minydom], {-2 Pi, -1*^-5},
               ImageSize -> 100],
              Slider[Dynamic[ydom], {1*^-5, 2 Pi},
               ImageSize -> 100]}}]},
          {Grid[{{Text[" Mesh"],
              Checkbox[Dynamic[mesh], {None, 5}]}}],
           Grid[{{Text[" Show volumes"], Checkbox[Dynamic[vol]]}}]},
          {Text[" Cylinders"], Slider[Dynamic[cyl], {1, 17, 1}]},
          {Grid[{{Text[" Lower Limit"],
              InputField[Dynamic[a], FieldSize -> 3]}}],

           Grid[{{Text[" Upper Limit"],
              InputField[Dynamic[b], FieldSize -> 3]}}]}},
         Background -> {None, Table[lb[k], {k, 0.6, .9, .05}]},
         Spacings -> 3]}, {Dynamic[
         Plot[func, {x, mindom, dom}, PlotRange -> {minydom, ydom},
          ImageSize -> 200, AxesLabel -> {"x", "y"}]]}}],
     Grid[{{SetterBar[
         Dynamic[xtrue], {True -> " x Rotation ",
          False -> " y Rotation "}]},
       {Grid[{{Text[" Inscribe"],
           Checkbox[Dynamic[insc], {True, False}]}}]}, {
        Dynamic[If[xtrue,
           Grid[{{

             Plot3D[{Sqrt[func^2 - y^2], -Sqrt[func^2 - y^2]}, {x,
               mindom, dom}, {y, minydom, ydom},
              Background -> lb[.95], PlotRange -> ydom, Mesh -> mesh,
              PlotStyle -> Opacity[.7], Axes -> True,
              AxesOrigin -> {0, 0, 0}, Boxed -> False,
              AxesLabel -> {text["x"], text["y"], text["z"]},
              Ticks -> None],
             Dynamic[Graphics3D[Table[{Hue[n], Opacity[.9],

                  Cylinder[{{n, 0, 0}, {n + (dom - mindom)/cyl, 0,
                    0}}, Abs[ func /. x -> (n + (dom - mindom)/cyl)]]},
                 {n, a, b (cyl - 1)/cyl, (dom - mindom)/cyl}] //
                Flatten, Ticks -> None, Background -> lb[.95],
               AxesLabel -> {text["x"], text["y"], text["z"]},
               Boxed -> False, Axes -> True, AxesOrigin -> {0, 0, 0},
               PlotRange -> {{mindom, dom}, {minydom, ydom}, {-ydom,
                  ydom}}]
              ]}, Flatten[{If[vol, {Grid[{{Style[\!\(
\*UnderoverscriptBox[\("\<\[Integral]\>"\), \(a\), \(b\)], \
                    Medium\)],
                   Style[\[Pi] (func)^2 \[DifferentialD]x,
                    Medium]}, {Abs[
                    NIntegrate[Pi func^2, {x, a, b}] // Quiet]}}],
                Grid[{{Style[
\!\(\*UnderscriptBox[
OverscriptBox[\("\<\[Sum]\>"\), \(cyl\)], \("\<j=1\>"\)]\), Medium],
                   Style[\[Pi] Subscript[r, j]^2 Subscript[h, j],
                    Medium]}, {Total[
                    Table[Abs[
                    Pi (b - a)/
                    cyl (1.) (func /. x -> (n + (b - a)/cyl))^2], {n,
                    a, b (cyl - 1)/cyl, (b - a)/cyl}]]}}]}]}]}]
          , Grid[{{

             Plot3D[{Sqrt[(funcy)^2 -
                x^2], -Sqrt[(funcy)^2 - x^2]}, {x, mindom, dom}, {y,
               minydom, ydom}, Background -> lb[.95],
              PlotRange -> dom, Mesh -> mesh,
              PlotStyle -> Opacity[.7], Axes -> True,
              AxesOrigin -> {0, 0, 0}, Boxed -> False,
              AxesLabel -> {text["x"], text["y"], text["z"]},
              Ticks -> None],
             Dynamic[Graphics3D[Table[{Hue[n], Opacity[.9],

                  Cylinder[{{0, n, 0}, {0, n + (b - a)/cyl, 0}},
                   Abs[funcy /. y -> (n + (b - a)/cyl)]]},
                 {n, a, b (cyl - 1)/cyl, (b - a)/cyl}] // Flatten,
               Ticks -> None,
               AxesLabel -> {text["x"], text["y"], text["z"]},
               Background -> lb[.95], Boxed -> False, Axes -> True,
               AxesOrigin -> {0, 0, 0},
               PlotRange -> {{mindom, dom}, {minydom, ydom}, {-dom,
                  dom}}]]
             }, {If[vol, {Grid[{{Style[\!\(
\*UnderoverscriptBox[\("\<\[Integral]\>"\), \(a\), \(b\)], \
                    Medium\)],
                   Style[\[Pi] (funcy)^2 \[DifferentialD]y,
                    Medium]}, {Abs[
                    NIntegrate[Pi funcy^2, {y, a, b}] // Quiet]}}],
                Grid[{{Style[
\!\(\*UnderscriptBox[
OverscriptBox[\("\<\[Sum]\>"\), \(cyl\)], \("\<j=1\>"\)]\), Medium],
                   Style[\[Pi] Subscript[r, j]^2 Subscript[h, j],
                    Medium]}, {Total[
                    Table[Abs[
                    Pi (1.) (b - a)/
                    cyl (funcy /. y -> (n + (b - a)/cyl))^2], {n, a,
                    b (cyl - 1)/cyl, (b - a)/cyl}]]}}]}]} // Flatten}]

          ]]
        }}]
     }}], Background -> lb[.95]]]

> On 10/20/11 10:48, Feinberg, Vladimir wrote:
>
>> Sorry, forgot the file!
>>
>> On Thu, Oct 20, 2011 at 7:47 AM, Feinberg, Vladimir
>> <13vladimirf at students.harker.**org <13vladimirf at students.harker.org>
>> <mailto:13vladimirf at students.**harker.org<13vladimirf at students.harker.org>>>
>> wrote:
>>
>>    Hello,
>>
>>    My name is Vlad, and I (erroneously) contacted the consultation
>>    center for Mathematica instead of you--they gave me some quick answers only.
>>
>>    I first was acquainted with Mathematica in my PreCalc class, and have been
>>    using it ever since.  I think it is an excellent tool, especially
>>    for its ability to create didactic visualizations.  I had some
>>    questions about Mathematica:
>>
>>    As a Calculus tutor, I wanted to provide my peers with a visual
>>    understanding to the "disk" method of calculating volume for
>>    functions rotated around the x or y axes.  All of the online
>>    demonstrations were very well formatted and looked sharp, but I
>>    wanted the students to be able to input their own functions, so I
>>    made my own Mathematica notebook (attachments).  Is it possible to input a
>>    Solve function, looking for x in terms of y, instead of asking for
>>    the inverse?  Every time I did so, my graphs ended up replacing the
>>    variable that was being solved for with the variables being plotted
>>    in 3D.
>>
>>    Also, I only have a vague concept of pure functions, and didn't
>>    really understand their purpose or how they work.  How are they
>>    different from regular functions?  When I saw them being used, they
>>    were really no different than, say, a Table function.
>>
>>    Thanks for the help,
>>    Vlad
>>    Vlad
>>


  • Prev by Date: Re: Initial value problem when using NDSolve for differential-algebraic system
  • Next by Date: Re: Ticks without labels
  • Previous by thread: Re: can not understand the symbol or the equation for an integration result
  • Next by thread: A basic question about RecurrenceTable - warning messages