I think kcrisman was referring to Sage for Undergraduates, my book,
perhaps?. That's what sparked this original conversation about the plot of
the cuberoot.
If people are curious, Sage for Undergraduates will be submitted any day
now to the American Mathematical Society. It is long over due. The PDF copy
will be free, and the printed book hopefully won't be too expensive. I do
not plan to update the text "real time" with minor corrections over the
months, (1) because I hope there aren't any errors, and (2) that's
incompatible with my teaching load.
However, I do explain that command called real_nth_root is coming soon,
that it will take care of this issue, and that it does not yet exist.
Moreover, this gave me a chance to praise the openness of open-source
software versus corporate software. Open source software allows for these
sorts of conversations leading to changes and upgrades.
---Greg
On Wednesday, July 9, 2014 11:49:19 AM UTC-4, David Smith wrote:
>
> Does "you" mean me? As best I can recall, the answer is no. But it's
> never too late for our book -- even though it's "published" (and has been
> for 4 years), we're constantly making improvements, ranging from fixing
> typos to replacing interacts with prettier or more effective ones for the
> same tasks. And when there is a cube root or nth root function that
> includes x<0 in the domain, we'll take advantage of that -- although it's
> not critical to our mission. We haven't bothered with revision numbers
> (bad practice, I know), and "version" (which we're about to drop) refers to
> the technology required. We have just posted our (final?) version,
> entirely Sage and MathJax based, no longer with any external CAS required.
> You can see the result at calculuscourse.maa.org, where the only links
> are to Full Text and Sample Chapters. The Sample is open to the public,
> while Full is behind a pay wall. However, until next Monday, you can see
> the full text at calculuscourse.maa.org/main2/ -- and comments are
> welcome. My sincere thanks to all who have helped us get up to speed on
> Sage interacts and responded to our requests for additional features. DAS
>
> On Tuesday, July 8, 2014 10:30:09 PM UTC-4, kcrisman wrote:
>>
>> Ah, I missed all this. Did you ever open a ticket (with this or Nils' or
>> other code)? I guess it's too late for your book (well, the 1st print
>> edition, on the internet revision means something different, as a recent
>> article I read on lit crit was pointing out...)
>>
>>
>>
>>
>>> def nth_real_root( x, n ):
>>> """Note: n must be a positive integer. However, x is any real
>>> number.
>>> (Otherwise this explanation will make no sense.)
>>> For odd values of n, we return the unique real number y such
>>> that y^n = x.
>>> For even values of n, if x<0, there is no real number y such
>>> that y^n = x and so we throw an exception.
>>> For even values of n, if x=>0, then we return the unique real
>>> number y such that y^n = x."""
>>>
>>> if ((n in ZZ)==false):
>>> raise RuntimeError('nth_real_root(x,n) requires n to be a
>>> positive integer. Your n is not an integer.')
>>>
>>> if (n<=0):
>>> raise RuntimeError('nth_real_root(x,n) requires n to be a
>>> positive integer. Your n is not positive.')
>>>
>>> assert (n in ZZ)
>>> assert (n>0)
>>>
>>> if ((n%2) == 0):
>>> # n is even
>>> if (x<0):
>>> raise RuntimeError('There is no nth real root (of a
>>> negative number x) when n is even.')
>>> else:
>>> return x^(1/n)
>>>
>>> assert ((n%2)==1)
>>> # n is odd
>>> return sign(x)*(abs(x))^(1/n)
>>>
>>>
>> By the way, apparently it's better to use a try/except clause than an
>> assert, so that we have a meaningful error message, or so I have heard, I'm
>> not a PEP guru.
>>
>
--
You received this message because you are subscribed to the Google Groups
"sage-edu" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-edu.
For more options, visit https://groups.google.com/d/optout.