On Aug 2, 10:47 pm, William Stein <wst...@gmail.com> 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)
>
> /Users/was/build/sage-4.5.1/<ipython console> in <module>()
>
> TypeError: list indices must be integers, not float
>
> > 2. UNITS
> > It would be nice to make SAGE capable of handling units and do unit
> > conversion.
> > Solution: There are already some Python modules that allow the "1 m"
> > syntax for a value with units. For some more complex units, I'd use a
> > syntax like "9.8 'kg*m/s^2' " (a literal number followed by a string),
> > or "9.8 [kg*m/s^2]" (a literal number followed by the units between
> > brackets).
>
> Sage already has extensive support for units.
>
> sage: kg = units.mass.kilogram; m = units.length.meter; s = units.time.second
> sage: a = (9.8 * kg * m / s^2); a
> 9.8000000000000007*kilogram*meter/second^2.0
> sage: a.convert(units.mass.gram * m / s^2)
> 9800.0*gram*meter/second^2.0
>
> > 3. BODE DIAGRAMS
> > I didn't find it easy to plot a Bode diagram of a function. The plot()
> > function doesn't appear to have a "logarithmic" option, and it doesn't
> > look easy to put 2 parallel plots on the same image, one on the upper
> > half and another on the lower half.
> > Solution: have a bode() function that does all the work (along with
> > nyquist() and maybe root_locus()). Extending the options on the plot()
> > function would also be nice (at least, add logarithmic_x and
> > logarithmic_y options).
>
> Parallel plots?   Do you mean like this:
>
> sage: graphics_array([plot(sin(x), 0, 3), plot(cos(x),0,3)],2,1)
>
> > 4. MATRIX INPUT
> > SAGE lacks an easy way to enter matrices. The easiest one is to do
> > something like "matrix([[1,2],[3,4]])", but that's uncomfortable,
> > specially for people who are used to Matlab's (or Octave's) "[1 2; 3
> > 4]".
> > Solution: My proposed syntax is "[[1,2],[3,4]]m", this is, a literal
> > list followed by an "m", as an alias to "matrix([[1,2],[3,4]])". Same
> > for "v" (vectors), "c" (complex numbers), maybe "q" (quaternions),
> > "p" (polynomials)...
>
> I think this is pretty easy:
>
> sage: matrix(2, [1,2,  3,4])
> [1 2]
> [3 4]
>
> I don't like your suggestion to introduce something that isn't valid
> Python to enter matrices.
>
> > 5. MATRIX INDEXES
> > I had written a long paragraph about how easy is to get slices of
> > matrices on Matlab/Octave and how good it would be to implement
> > something similar on SAGE with some examples, just to realize that it
> > was already implemented. :(
> > (some examples: mat[3], mat[1,2], mat[0:3], mat[[3,2,1,0]], mat[:,
> > 0]...)
>
> Moreover, if you use numpy arrays you get extremely powerful and
> efficient slicing into n-dimensional arrays.  This is very useful,
> e.g., when dealing with 3d scientific data.
>
>
>
> > 6. TRANSPOSE/CONJUGATE
> > If I want to get the transposed of a matrix, I have to write
> > "mat.transpose()", while on Matlab it's as easy as "mat' ". Same for
> > conjugating complex numbers or transposing+conjugating complex
> > matrices.
> > Solution: The solutions are to have a .T (or .H, .C...) attribute, or
> > to have a custom operator that conjugates and transposes, such as
> > "*mat" or "+mat" (the latter might be easier to implement since
> > there's already an unary "+" operator in Python that doesn't do
> > anything useful).
>

cvxopt matrices (you can use them in Sage if you like) have .T
attribute.

> Why don't you do this:
>
> sage: T = lambda x: x.transpose()
> sage: A = matrix(3, [1,2,  3,4, 5,6]); A
> [1 2]
> [3 4]
> [5 6]
> sage: T(A)
> [1 3 5]
> [2 4 6]
>
>
>
> > --
> > 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 
> > athttp://groups.google.com/group/sage-devel
> > URL:http://www.sagemath.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org

-- 
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