MathGroup Archive 1991

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

Search the Archive

Re: Bug in Tanh.

  • To: mathgroup at yoda.ncsa.uiuc.edu
  • Subject: Re: Bug in Tanh.
  • From: barry at math.ucla.edu
  • Date: Fri, 01 Mar 91 22:28:18 -0800

>I conclude that the problem must be between the interface of Mathematica
>and the 2.0 Operating system.
>(The same bug also occurs in my beta version Mathematica2.0 for the NeXT).

Note it must be a bug in the kernel, since it evaluates Tanh[x]
incorrectly----for example

Tanh[-1.8]

-1.053193987153732

Also, it is very strange, since it gets ``most'' of Tanh[x] correct
(as the Plot[] shows).

The moral: always plot functions before using them in more
complicated expressions!

[On my Sparcstation, I get

In[3]:= Tanh[-1.8]

Out[3]= -0.946806

which matches with tables in books.  Looks
like a NeXT problem to me. --- smc, moderator]
>From mathgroup-adm at yoda.ncsa.uiuc.edu Sat Mar  2 05:57:41 1991
Received: from yoda.ncsa.uiuc.edu by dragonfly.wri.com with SMTP id AA12404
  (5.65+/IDA-1.3.4 for cat >> /users/swolf/Mail/incoming); Sat, 2 Mar 91 05:57:41 -0600
Received: by yoda.ncsa.uiuc.edu id AA18105
  (5.64+/IDA-1.3.4 for ); Sat, 2 Mar 91 01:59:03 -0600
Received: by yoda.ncsa.uiuc.edu id AA18101
  (5.64+/IDA-1.3.4 for /usr/lib/sendmail -odq -oi -fmathgroup-adm at yoda.ncsa.uiuc.edu mathgroup-out); Sat, 2 Mar 91 01:59:01 -0600
Message-Id: <9103020759.AA18101 at yoda.ncsa.uiuc.edu>
Date: Sat, 2 Mar 91 02:18 EST
From: CAMERON at midd.cc.middlebury.edu
Subject: Re: A few questions
To: mathgroup at yoda.ncsa.uiuc.edu

Charles Bruen (cabruen at athena.mit.edu) asks:

> 1) Why does mathematica lose the font selection I have made for text
> cells. I have a paragraph of text describing a function, and I dont want
> it in chicago (the default). I am running a Macintosh front end.

    I don't have a Mac, and you weren't very detailed in posing your
    question, so I can't say for sure what's causing this.  But if it's
    affecting only certain individual cells you might be able to restore
    them to sanity with the "Default Styles" item of the Style menu,
    which resets the styles for selected cells to whatever is specified
    for that kind [or those kinds] of cell in the Notebook's style
    sheet.  If the Notebook's entire style sheet is messed up, try the
    "All Default Styles" item from the same menu to reset the entire
    Notebook to global defaults.

> 2) Is it possible to a 3D plot only over certain sections (such as a
> circle) instead of the boxed area that is the default. I want a pressure
> plot of a circle with radius 2. I can plot it out, but I get the
> pressure plot from {x,-2,2} {y,-2,2}, and the function is
> meaningless outside of the range of the circle.

Plot3D only plots over rectangular regions.
There are (at least) two ways to do what you want to do:

a) Define a new function:

     foo[x_,y_] := 0 /; (x^2+y^2)>4
     foo[x_,y_] := YourRealFunction[x,y]

   This will artificially define the function to be zero outside
   the circle; then you can use Plot3D.

   This may or may not be suitable, depending on what function you're
   working with and what kind of graph you need.

b) Use ParametricPlot3D:

     f[x_,y_] := Cos[ x Sqrt[4 - x^2 -y^2] ] Sin[y]

         (* or whatever your real function is *)

     Needs["Graphics'ParametricPlot3D'"];

     ParametricPlot3D[
        Block[ { x = r Cos[t], y = r Sin[t] }, {x,y,f[x,y]} ],
        {r,0,2,.25}, {t,0,2Pi,Pi/8}
     ]

> 3) Are they taking student orders for 2.0 yet. I called 1 1/2 months
> ago and they were still peddling 1.2?

    I have no idea when they'll leave off peddling 1.2 and begin
    peddling 2.0.  It's still in beta testing at the moment, though.

    Don't you think it would be more direct to simply call WRI and ask
    them?  It's a free call, after all (1-800-441-6284) and nobody on
    this list is likely to know more than the WRI sales staff what WRI's
    plans and timetable are.

    One thing I do know is that if you buy the regular version of Mma
    now, you get 25% off the old list prices *and* a free upgrade to
    2.0 when it's released.  I don't know whether this applies to the
    student version of Mma, however. (I doubt that it does.)

> 4) Is it possible to label the Axes on a Plot3D graph. I tried the plot
> parameter AxesLabel->{"xlabel", "ylabel"} but it did not work.

    As Nancy Blachman already pointed out, in 3D graphics you need
    three axis labels.  AxesLabel->{"xlabel","ylabel","zlabel"} works.
    If you don't want a z-axis label, use "".

--Cameron Smith
  Mathematica consultant
  cameron at midd.cc.middlebury.edu


  • Prev by Date: New version of TeX/Mathematica tools
  • Next by Date: Tanh
  • Previous by thread: New version of TeX/Mathematica tools
  • Next by thread: Tanh