Re: cool new sytax feature in Mathematica 6, compete with Matlab?



In Mathemtica 6, now one can type
A = Table[Random[], {5}, {5}]

Hi. I like it to. :>)
Just a note about Random[] from help...(Which I like also)

"...As of Version 6.0, Random has been superseded by the functions
RandomReal and RandomInteger."

--
Dana


"Nasser Abbasi" <nma@xxxxxxxxx> wrote in message
news:uSt1i.278606$g24.98025@xxxxxxxxxxxxxxx
I just found a nice new synatx in Mathematica 6.

As any one who programmed in Matlab knows that Matlab has some nice short
cuts for working with matrices, One is the use of ':' to indicate a range
(which Fortran also has)

So, typing A(1:10) in Matlab means the elements 1 to 10.

Now in Mathematica one can do the same, but the syntax is ';;'

So, given a matrix A, say of size 5x5, and say we want to print rows 2 to
4 for columns 1 to 3 only. In Matlab we type

A=rand(5,5);
A( 2:4 , 1:3 )

In Mathemtica 6, now one can type

A = Table[Random[], {5}, {5}]
A[[ 2 ;; 4 , 1 ;; 3 ]]

isn't that cool or what?

ofcourse one can still use the Range[] to do the same

A[[ Range[2, 4], Range[1, 3] ]]

But I think ;; is better and less typing.

(What out Matlab, Mathematica is coming after you ;)

Nasser



.



Relevant Pages

  • Mathematica Symbolic Toolbox for MATLAB--Version 2.0
    ... The Mathematica Symbolic Toolbox for MATLAB ... He is responsible for leading the MathLink ... The Mathematica Symbolic Toolbox for MATLAB is ...
    (sci.math.symbolic)
  • Re: Mathematica Vs. Matlab
    ... Mathematica is a powerful CAS. ... Maple, REDUCE, MuPAD (it can be legally obtained for free at some circumstances, ... There are a number of programs to do numerical calculations with usual ... One example is Matlab; ...
    (sci.math.symbolic)
  • Re: Mathematica Vs. Matlab. It is not a superset
    ... Initially you deemed ANY comparison of Matlab vs. Mathematica invalid, ... a natural language. ... > I don't think the Dean of your ...
    (sci.math.symbolic)
  • Re: Mathematica Vs. Matlab. It is not a superset
    ... hmmm, reading the previous emails in this email chain, you were an ardent ... opponent of any comparison of any kind between Mathematica and Matlab, ... Mathematica is really much superior to Matlab? ... specially engineering problems. ...
    (sci.math.symbolic)
  • Maple vs Mathematica questions: symbolic & MacOS aspects only.
    ... has perhaps come to change CAS. ... I will keep on using Matlab at this ... than Maple where numerics are concerned. ... Mathematica, but will do so. ...
    (sci.math.symbolic)