Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: Re: What to do in v. 6 in place of

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76821] Re: [mg76767] Re: [mg76728] Re: What to do in v. 6 in place of
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 28 May 2007 00:56:03 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200705270850.EAA03202@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Imagine trying to introduce a beginner in Mathematica to plotting a 
"simple" function like the real cube-root by means of that code!  Enough 
to put them off Mathematica for life.

Bob Hanlon wrote:
> This works for simple cases such as your examples.
> 
> Clear[realPlot];
> realPlot[expr_,
>    {x_Symbol, xmin_?NumericQ, xmax_?NumericQ},
>    opts___] := Module[{d, e, f, y},
>    e = Flatten@{expr};
>    d = (Denominator@PowerExpand@Log[x, #] & /@ e);
>    f = y /. (ToRules@
>          Reduce[y^#[[2]] == PowerExpand[#[[1]]^#[[2]]],
>           y, Reals] & /@ Thread[{e, d}]);
>    Plot[f, {x, xmin, xmax}, opts]];
> 
> Grid[{{realPlot[x^(1/3), {x, -8, 8}],
>    realPlot[x^(3/5), {x, -8, 8}]},
>   {realPlot[{x^(1/3), x^(3/5)}, {x, -8, 8}]}}]
> 
> 
> Bob Hanlon
> 
> ---- Helen Read <read at math.uvm.edu> wrote: 
>> David W.Cantrell wrote:
>>> Helen Read <read at math.uvm.edu> wrote:
>>>> Suppose my calculus students want to plot x^(1/3), for say {x,-8,8}. The
>>>> problem, of course, is that Mathematica returns complex roots for x<0.
>>>> In past versions of Mathematica, we could get the desired real roots
>>>> (and plot the function) by loading the package Miscellaneous`RealOnly. I
>>>> guess we can still do it that way (and ignore the "obsolete package"
>>>> message), but is there a suggested way of doing what we need in 6.0?
>>> Perhaps have them define their own
>>>
>>> realCubeRoot[x_]:= Sign[x] Abs[x]^(1/3)
>>>
>>> which plots as desired, of course.
>> Well, yes, but it's kind of a pain to have to define their own root 
>> functions this way on an individual basis. (Not to mention, it 
>> completely hoses the derivative. Try realCubeRoot'[x] or 
>> realCubeRoot'[-8] and see what you get.)
>>
>> I was hoping for a more convenient way to do this in Mathematica 6.0. 
>> Surely it *knows* the real nth roots of x for n odd and x<0. It would be 
>> nice to be able to define f[x_]=x^(1/3) or x^(3/5) or whatever and just 
>> set some option to make it return the real value for x<0.
>>
>> --
>> Helen Read
>> University of Vermont
>>
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Manipulate (from Wolfram Demonstrations)
  • Next by Date: [Admin] MathGroup Issues
  • Previous by thread: Re: Re: What to do in v. 6 in place of
  • Next by thread: Re: What to do in v. 6 in place of