MathGroup Archive 1995

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

Search the Archive

Re: Mathematica Graphics

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1820] Re: Mathematica Graphics
  • From: kluge at seuss.cc.utexas.edu ()
  • Date: Thu, 3 Aug 1995 23:51:34 -0400
  • Organization: Computation Center, University of Texas

Jeff Benvenuti asks:

>1)I can't save Mathematica graphics in files properly in order to get 
>  them back afterwards on my HP screen.

 There are a number of ways to do this, one of the easiest is to
use xv (a standard X utility) to grab a section of the screen (in this
case your Mathematica graphic) and save it as a gif or jpeg.  An image
that is more useful for importing to many applicatins can be obtained
by issuing the mathematica command:

 Display["!psfix -epsf > some_file.eps", some_mathematica_graphics_object]

for example:
In[1]:=
  Plot[Sin[x],{x,0,2 Pi}]
In[2]:=
  Display["!psfix -epsf > sin.eps", %1]

The eps file (sin.eps) can then be viewed with ghostscript, or utilized by
a text processor such as TeX.

>2)How can one Animate Graphics on a HP?,ie plot successively Mathematica
>  images  as in a movie?

 The following is from a Mathematica graphics FAQ I am constructing at
http://www-math.cc.utexas.edu/math/Mathematica/graphics/  Of course
this is much clearer with the illustrations that are available at the
above www site.

-----------------------------------------------------------------------
Mathematica has a number of ways to generate animations. There are some
features which they all have in common. Animation in Mathematica is
accomplished by first generating a series of images, then displaying them
in rapid succession. 

Let us start with the solution to a differential equation. 

   In[1]:=
        Solution = DSolve[{ x''[t] + kd x'[t] +  x[t] == 0,
                           x[0] == 10,
                           x'[0] == 0},
                          x[t], t]
   Out[1]:=
                                         2
                     ((-kd - Sqrt[-4 + kd ]) t)/2)              5 kd        
         {{x[t] -> E^                                 (5 -  --------------) +
                                                                        2
                                                            Sqrt[-4 + kd ]
   
                                         2
                     ((-kd + Sqrt[-4 + kd ]) t)/2)              5 kd        
                   E^                                 (5 +  --------------)}}
                                                                        2
                                                            Sqrt[-4 + kd ]

We now have an equation with two free parameters. This allows us to generate
a series of graphs of x vs t, each with a differing value of kd. We then
display those graphs as a movie. The first step is accomplished with: 

   In[2]:=
        Table[Plot[x[t] /. Solution, {t,0,20},
                   PlotRange -> {-10, 10},
                   AxesLabel -> {Time, Amplitude}],
              {kd, 0, 3, .08}];
This generates a long series of graphs. The PlotRange was specified explicitly
to maintain a constant verticle scale from frame to frame. To prepare this
series of frames to become a movie double-click on the second cell bracket,
the one that covers all the frames of the movie. This will colapse the frames
into a single cell. 

To play such a colapsed set of frames as a movie, double click on the top
image. You will have to wait a bit for the movie to start, especially if
there are a large number of frames. 
---------------------------------------------------------------------------



                                 Alex Kluge
                                 http://www-math.cc.utexas.edu/~kluge/


  • Prev by Date: Re: Mathematica Graphics
  • Next by Date: fractals
  • Previous by thread: Re: Mathematica Graphics
  • Next by thread: fractals