618 views

Skip to first unread message

Jan 3, 2009, 12:00:47 PM1/3/09

to sage-support

When i try to solve this equation:

solve(x^2*log(x, 2) == 1, x);

It answers me:

[x^2 == log(2)/log(x)]

It,s true, but how can i get the numerical value of x?

solve(x^2*log(x, 2) == 1, x);

It answers me:

[x^2 == log(2)/log(x)]

It,s true, but how can i get the numerical value of x?

Jan 3, 2009, 6:54:15 PM1/3/09

to sage-s...@googlegroups.com

sage: plot(x^2*log(x,2)-1, 0,2)

[nice plot so you can understand what is going on]

sage: find_root(x^2*log(x,2)-1,1, 2)

1.4142135623730951

Jan 3, 2009, 7:10:24 PM1/3/09

to sage-s...@googlegroups.com

>>

sage: plot(x^2*log(x,2)-1, 0,2)

[nice plot so you can understand what is going on]

sage: find_root(x^2*log(x,2)-1,1, 2)

1.4142135623730951

<<

Hi, I'm trying out SAGE for the first time, so I entered what you
sage: plot(x^2*log(x,2)-1, 0,2)

[nice plot so you can understand what is going on]

sage: find_root(x^2*log(x,2)-1,1, 2)

1.4142135623730951

<<

suggested (see above).

Now, from the plot, it there seems to be no other roots between 0 and 2

so I entered

sage: find_root(x^2*log(x,2)-1,0, 2)

and got the root = 0.0

what am I missing here?

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Applied Math, Physics and Comp Sci

Baldwin High and Nassau CC

The Calculus and CompSci Project Online!

http://calcpage.tripod.com

-----Original Message-----

From: William Stein <wst...@gmail.com>

To: sage-s...@googlegroups.com

Sent: Sat, 3 Jan 2009 6:54 pm

Subject: [sage-support] Re: How to make Sage to solve the equation?

Jan 3, 2009, 7:18:02 PM1/3/09

to sage-s...@googlegroups.com

On Jan 3, 2009, at 4:10 PM, calc...@aol.com wrote:

> sage: plot(x^2*log(x,2)-1, 0,2)

> [nice plot so you can understand what is going on]

>

> sage: find_root(x^2*log(x,2)-1,1, 2)

> 1.4142135623730951

> <<

>

> Hi, I'm trying out SAGE for the first time, so I entered what you

> suggested (see above).

>

> Now, from the plot, it there seems to be no other roots between 0

> and 2

> so I entered

>

>

> sage: find_root(x^2*log(x,2)-1,0, 2)

> and got the root = 0.0

>

> what am I missing here?

This function is not defined at the left endpoint, so you are

probably violating some assumption on the underlying optimization

algorithm used. However, I would much rather have an error here than

an incorrect value.

- Robert

Jan 3, 2009, 7:19:21 PM1/3/09

to sage-support

On Jan 3, 4:10 pm, calcp...@aol.com wrote:

> sage: plot(x^2*log(x,2)-1, 0,2)

> [nice plot so you can understand what is going on]

>

> sage: find_root(x^2*log(x,2)-1,1, 2)

> 1.4142135623730951

> <<

>

> Hi, I'm trying out SAGE for the first time, so I entered what you

> suggested (see above).

>

> Now, from the plot, it there seems to be no other roots between 0 and 2

> so I entered

>

> sage: find_root(x^2*log(x,2)-1,0, 2)

> and got the root = 0.0

>

> what am I missing here?

sage: sage: find_root(1/(x-1)+1,0, 2)

0.0

sage: sage: find_root(1/(x-1)+1,0.00001, 2)

1.0000000000011564

It seems that there is trouble when you have a singularity for one of

that starting points. Obviously this needs to be fixed :)

> TIA,

> AJG

Cheers,

Michael

> A. Jorge Garcia

> Teacher and Professor

> Applied Math, Physics and Comp Sci

> Baldwin High and Nassau CC

>

Jan 3, 2009, 7:33:29 PM1/3/09

to sage-s...@googlegroups.com

Exactly, the function log base 2 of x is not defined at 0.

So, why won't sage return some sort of domain error?

I noticed something similar when I plotted (x^2-1)/(x-1) and got the

graph of x+1.

I was hoping for a removeable discontinuity to show in the graph!

IE a hole in y=x+1 at x=1.

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Applied Math and Comp Sci

mailto:calc...@aol.com

ftp://ftp.baldwinschools.net

http://calcpage.tripod.com/bshs

So, why won't sage return some sort of domain error?

I noticed something similar when I plotted (x^2-1)/(x-1) and got the

graph of x+1.

I was hoping for a removeable discontinuity to show in the graph!

IE a hole in y=x+1 at x=1.

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Baldwin High and Nassau CC

Long Island, NY, USA
mailto:calc...@aol.com

ftp://ftp.baldwinschools.net

http://calcpage.tripod.com/bshs

Jan 3, 2009, 7:48:10 PM1/3/09

to sage-support

On Jan 3, 4:33 pm, calcp...@aol.com wrote:

Hi AJG,

> Exactly, the function log base 2 of x is not defined at 0.

> So, why won't sage return some sort of domain error?

there, but we will check. Somebody please open a ticket for this.

> I noticed something similar when I plotted (x^2-1)/(x-1) and got the

> graph of x+1.

> I was hoping for a removeable discontinuity to show in the graph!

> IE a hole in y=x+1 at x=1.

----------------------------------------------------------------------

| Sage Version 3.2.3.final, Release Date: 2009-01-02 |

| Type notebook() for the GUI, and license() for information. |

----------------------------------------------------------------------

sage: f=(x^2-1)/(x-1); f

(x^2 - 1)/(x - 1)

sage: f.simplify()

(x^2 - 1)/(x - 1)

sage: f.simplify_full()

x + 1

sage:

Not sure is this is an issue with Maxima, but I would guess so.

simplify_full() shouldn't do this since it is clearly mathematically

not equivalent. My suspicion is that we probably call simplify_full()

before plotting and/or feeding it into _fast_float(). Someone please

open another ticket for this one.

> TIA,

> AJG

Cheers,

Michael

> A. Jorge Garcia

> Teacher and Professor

> Applied Math and Comp Sci

> Baldwin High and Nassau CC

> Long Island, NY, USA

>

Jan 3, 2009, 8:01:13 PM1/3/09

to sage-s...@googlegroups.com

That's another issue: how do I know which package SAGE is using for a

particular task. You mention there may be a problem with maxima or

numpy, how are we to know?

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

particular task. You mention there may be a problem with maxima or

numpy, how are we to know?

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Jan 3, 2009, 8:05:33 PM1/3/09

to sage-s...@googlegroups.com

"cancelling the greatest common divisor of the numerator and

denominator..." in the docs for ratexpand, which is called in the

course of the above. Who says simplify_full() shouldn't do the above?

Mathematica also does the above simplification:

sage: mathematica.eval('Simplify[(x^2-1)/(x-1)]')

1 + x

I don't think there is any claim that simplify(expr) gives back a 100%

mathematically equivalent expression. However, the types of changes

that occur are well defined.

> My suspicion is that we probably call simplify_full()

> before plotting and/or feeding it into _fast_float(). Someone please

> open another ticket for this one.

William

>

>> TIA,

>> AJG

>

> Cheers,

>

> Michael

>

>> A. Jorge Garcia

>> Teacher and Professor

>> Applied Math and Comp Sci

>> Baldwin High and Nassau CC

>> Long Island, NY, USA

>>

>> mailto:calcp...@aol.comftp://ftp.baldwinschools.nethttp://calcpage.tripod.com/bshs

> >

>

William Stein

Associate Professor of Mathematics

University of Washington

http://wstein.org

Jan 3, 2009, 8:06:32 PM1/3/09

to sage-support

On Jan 3, 5:01 pm, calcp...@aol.com wrote:

> That's another issue: how do I know which package SAGE is using for a

> particular task. You mention there may be a problem with maxima or

> numpy, how are we to know?

some developer will be able to tell you. You can look at the source

code of some operation foo by running foo??

> TIA,

> AJG

Cheers,

Michael

> A. Jorge Garcia

> Teacher and Professor

>

Jan 3, 2009, 8:12:01 PM1/3/09

to sage-support

seems to be more careful here than MMA. But then I don't do symbolic

manipulation, but I must say I am very surprised.

> Mathematica also does the above simplification:

>

> sage: mathematica.eval('Simplify[(x^2-1)/(x-1)]')

> 1 + x

maybe the MMA documentation defines what Simplify does.

> I don't think there is any claim that simplify(expr) gives back a 100%

> mathematically equivalent expression. However, the types of changes

> that occur are well defined.

> > My suspicion is that we probably call simplify_full()

> > before plotting and/or feeding it into _fast_float(). Someone please

> > open another ticket for this one.

>

> I do not think fast_float calls simplify_full.

more familiar with the plotting code will find out.

> William

Cheers,

Michael

Jan 3, 2009, 8:44:09 PM1/3/09

to sage-s...@googlegroups.com

On Jan 3, 2009, at 4:33 PM, calc...@aol.com wrote:

> Exactly, the function log base 2 of x is not defined at 0.

> So, why won't sage return some sort of domain error?

Sage doesn't test to see if the function is defined on the whole

domain (if this is even a decidable question in general, and I bet

it's not), it just passes the expression to maxima and/or numpy. Of

course, there is lots of room for improvement, and I don't like the

current behavior.

> I noticed something similar when I plotted (x^2-1)/(x-1) and got the

> graph of x+1.

> I was hoping for a removeable discontinuity to show in the graph!

> IE a hole in y=x+1 at x=1.

If you evaluate (x^2-1)/(x-1) at 100, or even 1000s of random points

say, between 0 and 10, chances are very slim you'll try and evaluate

it at the point x=1. Thus when you interpolate the rest of the graph

it would come out as a straight line. Also, it's unclear how much of

a "hole" you would want to see--mathematically even one pixel would

be too large.

It would be nice to do something more clever than evaluate at a bunch

of points and "connect" the dots, but then there is no end to the

amount of cleverness one could ask for.

- Robert

Jan 3, 2009, 9:08:33 PM1/3/09

to sage-s...@googlegroups.com

In a message dated 1/3/2009 8:44:30 P.M. Eastern Standard Time,
robe...@math.washington.edu writes:

Also, it's unclear how much of

a "hole" you would want to see--mathematically even one pixel would

be too large.

Sorry, I suppose I'm spoiled by using the TI-89 graphing calculator, which
is based on an app called derive if I'm not mistaken, where these domain issues
are handled differently....

Thanx for all
the info,

AJG

**A. Jorge Garcia**

Teacher & Professor

Applied Math, Physics & CS

Baldwin HS & Nassau CC

calc...@aol.com

cisthe...@aol.com

__CALCPAGE: The CALCulus and Computer Science Archive
PAGE__

http://calcpage.tripod.com

__SFFBCLUB: Science Fact & Fiction Book CLUB__

Search EBay for "ti active"

Search Ebay for "knoppix slax"

Search EBay for "knoppix quantian"

Search EBay for "knoppix manual"

Search EBay for "fractal art signed numbered"

__CISTHETA: The
OpenMosix Linux Cluster__

http://cistheta2007.deviantart.com

__YOUTUBE: APCS Instructional Videos__

http://www.youtube.com/cistheta2007

__CENTAURI: APCS ftpSite__

ftp://centauri.baldwinschools.net

ftp://65.254.7.10

AJG

Teacher & Professor

Applied Math, Physics & CS

Baldwin HS & Nassau CC

calc...@aol.com

cisthe...@aol.com

http://calcpage.tripod.com

Search EBay for "ti active"

Search Ebay for "knoppix slax"

Search EBay for "knoppix quantian"

Search EBay for "knoppix manual"

Search EBay for "fractal art signed numbered"

http://cistheta2007.deviantart.com

http://www.youtube.com/cistheta2007

ftp://centauri.baldwinschools.net

ftp://65.254.7.10

New year...new news. Be the first to know what is making headlines.

Jan 4, 2009, 9:26:34 AM1/4/09

to sage-s...@googlegroups.com

2009/1/4 mabshoff <Michael...@mathematik.uni-dortmund.de>:

This gets to the heart of something which has has bugged students and

computer algebra systems from the year dot.

From one point of view, (x^2-1)/(x-1) defines a "rational function" in

one variable, i.e. an element of the field of all rational functions,

denoted CC(x) if the coefficients come from CC (say). In this

algebraic context, the element just defined is the same as the element

x+1 and the simplification is 100% valid.

From another point of view, (x^2-1)/(x-1) is a formula defining a

function of x for all values of x where the function is "defined", so

-- as this is a fraction -- excluding any values where the denominator

evaluates to 0. In that case it defines a function on the punctured

domain where x!=1. In this case, as the original poster remarks, it's

a removable singularity and if we define the function's value at x=1

to be 2 then we get back the function x+1.

Things get much more complicated when there are side conditions (and,

taken to the extreme, would probably lead on to full-scale algebraic

geometry, schemes and all. For example, if you are interested in

functions f(x,y) on the circle x^2+y^2=1, then x/(1-y)=(1+y)/x; the

first expression is "defined" except at (0,1), while the second is

defined except at either (0,1) and (0,-1). There are examples where

no one expression gives you something which is "defined" in the naive

sense everywhere the function is defined.

What this shows is that there is no magic simple solution which will

work and keep everyone happy in all such situations. I think that

cancelling common factors from a fraction is perfectly sensible, even

though it enlarges the domain of definition of the functions. So I am

happy with a computer algebra system simplifying (x^2-1)/(x-1) to x+1.

On the other hand, I know from teaching experience that there are

situations where one would want to keep the two separate.

John

computer algebra systems from the year dot.

From one point of view, (x^2-1)/(x-1) defines a "rational function" in

one variable, i.e. an element of the field of all rational functions,

denoted CC(x) if the coefficients come from CC (say). In this

algebraic context, the element just defined is the same as the element

x+1 and the simplification is 100% valid.

From another point of view, (x^2-1)/(x-1) is a formula defining a

function of x for all values of x where the function is "defined", so

-- as this is a fraction -- excluding any values where the denominator

evaluates to 0. In that case it defines a function on the punctured

domain where x!=1. In this case, as the original poster remarks, it's

a removable singularity and if we define the function's value at x=1

to be 2 then we get back the function x+1.

Things get much more complicated when there are side conditions (and,

taken to the extreme, would probably lead on to full-scale algebraic

geometry, schemes and all. For example, if you are interested in

functions f(x,y) on the circle x^2+y^2=1, then x/(1-y)=(1+y)/x; the

first expression is "defined" except at (0,1), while the second is

defined except at either (0,1) and (0,-1). There are examples where

no one expression gives you something which is "defined" in the naive

sense everywhere the function is defined.

What this shows is that there is no magic simple solution which will

work and keep everyone happy in all such situations. I think that

cancelling common factors from a fraction is perfectly sensible, even

though it enlarges the domain of definition of the functions. So I am

happy with a computer algebra system simplifying (x^2-1)/(x-1) to x+1.

On the other hand, I know from teaching experience that there are

situations where one would want to keep the two separate.

John

Jan 4, 2009, 9:35:15 PM1/4/09

to sage-s...@googlegroups.com

Hi, I see that sage can call mathematica functions - I suppose that

only works if I have mathematica installed.

What I'm wondering is if I can import a mathmatica notebook into sage?

We used to have mathematica at my school and I remember using some very

nice mathematica notebooks by Jerry Uhl (University of Illinois?) that

served as workbooks for teaching calculus. Can I use these notebooks

with sage?

Also, I see that sage uses lots of great FOSS math apps. One I don't

see, and wonder why its not included, is Octave which would give MATLAB

functionality to sage. I'm wondering why Octave is not part of sage?

I thought sage was to be an alternative to Magma, Mathematica and

MATLAB.

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Applied Math and Comp Sci

Baldwin High and Nass CC

only works if I have mathematica installed.

What I'm wondering is if I can import a mathmatica notebook into sage?

We used to have mathematica at my school and I remember using some very

nice mathematica notebooks by Jerry Uhl (University of Illinois?) that

served as workbooks for teaching calculus. Can I use these notebooks

with sage?

Also, I see that sage uses lots of great FOSS math apps. One I don't

see, and wonder why its not included, is Octave which would give MATLAB

functionality to sage. I'm wondering why Octave is not part of sage?

I thought sage was to be an alternative to Magma, Mathematica and

MATLAB.

TIA,

AJG

A. Jorge Garcia

Teacher and Professor

Applied Math and Comp Sci

Jan 4, 2009, 9:46:56 PM1/4/09

to sage-s...@googlegroups.com

On Sun, Jan 4, 2009 at 6:35 PM, <calc...@aol.com> wrote:

>

> Hi, I see that sage can call mathematica functions - I suppose that

> only works if I have mathematica installed.

>

> What I'm wondering is if I can import a mathmatica notebook into sage?

> We used to have mathematica at my school and I remember using some very

> nice mathematica notebooks by Jerry Uhl (University of Illinois?) that

> served as workbooks for teaching calculus. Can I use these notebooks

> with sage?

>

> Hi, I see that sage can call mathematica functions - I suppose that

> only works if I have mathematica installed.

>

> What I'm wondering is if I can import a mathmatica notebook into sage?

> We used to have mathematica at my school and I remember using some very

> nice mathematica notebooks by Jerry Uhl (University of Illinois?) that

> served as workbooks for teaching calculus. Can I use these notebooks

> with sage?

No.

> Also, I see that sage uses lots of great FOSS math apps. One I don't

> see, and wonder why its not included, is Octave which would give MATLAB

> functionality to sage. I'm wondering why Octave is not part of sage?

> I thought sage was to be an alternative to Magma, Mathematica and

> MATLAB.

1. Sage includes numpy and scipy, which are native Python libraries

that provide most MATLAB functionality to Sage. See, e.g.,

http://www.scipy.org/NumPy_for_Matlab_Users

To include Octave as well would be a huge duplication of

functionality. (Sage also includes GSL -- the Gnu Scientific Library

-- which again would overlap a lot with Octave for functionality.)

2. Octave is very time consuming to build from source, since it is a

large C++ program.

3. Octave as a binary is very easy to install on any modern system, so

there is little point in including it in Sage, since people can easily

just install it. There is a Sage/Octave interface, so you can use

Octave from Sage.

4. Octave is licensed GPLv3, so we can't include it with Sage anyways.

-- William

Jan 4, 2009, 10:13:03 PM1/4/09

to sage-s...@googlegroups.com

On Jan 4, 2009, at 9:35 PM, calc...@aol.com wrote:

>

> Hi, I see that sage can call mathematica functions - I suppose that

> only works if I have mathematica installed.

>

> What I'm wondering is if I can import a mathmatica notebook into sage?

> We used to have mathematica at my school and I remember using some

> very

> nice mathematica notebooks by Jerry Uhl (University of Illinois?) that

> served as workbooks for teaching calculus. Can I use these notebooks

> with sage?

>

You could display the notebooks with Mathematica Player and if you want

to do more with them, try and convert them to Sage.

As for Octave, unless there is something specific, I highly recommend

Numpy and SciPy like William stated.

Cheers,

Tim.

---

Tim Lahey

PhD Candidate, Systems Design Engineering

University of Waterloo

http://www.linkedin.com/in/timlahey

Jan 5, 2009, 3:29:33 PM1/5/09

to sage-support

On Jan 3, 4:18 pm, Robert Bradshaw <rober...@math.washington.edu>

wrote:

and it is a blocker for 3.3.

Cheers,

Michael

Jan 5, 2009, 5:35:53 PM1/5/09

to sage-s...@googlegroups.com

In a message dated 1/4/2009 10:13:33 P.M. Eastern Standard Time,
tim....@gmail.com writes:

You could display the notebooks with Mathematica Player and if you want

to do more with them, try and convert them to Sage.

Thanx for the suggestion. Mathematica Player is an alternative,
however, these are supposed to be interactive worksheets. I suppose my
question is, how do I go about converting Mathematica Notebooks into Sage
Notebooks?

As for Octave, I did not realize all the functionality numpy and scipy
provide and how difficult it is to compile Octave, so I can live without Octave
for now!

TIA,

AJG

**A. Jorge Garcia**

AJG

Teacher & Professor

Applied Math, Physics & CS

Baldwin HS & Nassau CC

http://calcpage.tripod.com

Search EBay for "ti active"

Search Ebay for "knoppix slax"

Search EBay for "knoppix quantian"

Search EBay for "knoppix manual"

Search EBay for "fractal art signed numbered"

http://cistheta2007.deviantart.com

http://www.youtube.com/cistheta2007

ftp://centauri.baldwinschools.net

ftp://65.254.7.10

Jan 5, 2009, 5:42:00 PM1/5/09

to sage-s...@googlegroups.com

On Mon, Jan 5, 2009 at 2:35 PM, <Calc...@aol.com> wrote:

> In a message dated 1/4/2009 10:13:33 P.M. Eastern Standard Time,

> tim....@gmail.com writes:

>

> You could display the notebooks with Mathematica Player and if you want

> to do more with them, try and convert them to Sage.

>

> Thanx for the suggestion. Mathematica Player is an alternative, however,

> these are supposed to be interactive worksheets. I suppose my question is,

> how do I go about converting Mathematica Notebooks into Sage Notebooks?

>

The only way is to rewrite the notebooks from scratch using the
> In a message dated 1/4/2009 10:13:33 P.M. Eastern Standard Time,

> tim....@gmail.com writes:

>

> You could display the notebooks with Mathematica Player and if you want

> to do more with them, try and convert them to Sage.

>

> Thanx for the suggestion. Mathematica Player is an alternative, however,

> these are supposed to be interactive worksheets. I suppose my question is,

> how do I go about converting Mathematica Notebooks into Sage Notebooks?

>

mathematica notebooks as inspiration. The Sage language and

mathematica languages (and capabilities) are distinct.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu