On 08/ 2/10 09:47 PM, William Stein wrote:
On Mon, Aug 2, 2010 at 1:38 PM, cousteau<cousteaulecommand...@gmail.com>  wrote:
I'm studying engineering, and I'm used to some programs such as
Matlab, Maple, etc. When I knew about SAGE I found it very powerful,
simple and well structured, but I quickly found out that it wouldn't
be very useful in engineering, which is more oriented to numerical
analysis and simple math operations than to abstract algebra. Although
I could just use Octave for this, I'd like to be able to use SAGE for
some engineering-oriented tasks. Here are some proposed features:

1. ENGINEERING MODE
Since SAGE is oriented to mathematics, all numbers are considered
Integer unless otherwise specified (an integer is converted using
Integer() to SAGE's inner type). This isn't practical for engineers,
who normally use real numbers.
Solution: There should be a variable that caused all numbers to be
converted to RealNumber by default instead of Integer, even if an
integer was entered.


You can make this happen as follows:

sage: RealNumber=float; Integer=float
sage: 2 + 3
5.0
sage: 4/7
0.5714285714285714

Note that this will screw many things up big-time, e.g., list indexing
is broken:

sage: v = [1,2,3]
sage: v[2]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

So making it happen the way you indicate will screw things up. Therefore is not a viable option.

In Mathematica, I can put a dot after a number, and that will mean I want a 
float.

In[1]:= 3/2

        3
Out[1]= -
        2

In[2]:= 3/2.

Out[2]= 1.5

In[3]:= 3./2

Out[3]= 1.5



When I tried that trick in Sage, it works too.

sage: 3/2
3/2
sage: 3./2
1.5
sage: 3/2.
1.5

It's no great hardship to add a dot whenever you want a floating point number.

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to