Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10895 > unrolled thread
| Started by | "djmpark" <djmpark@comcast.net> |
|---|---|
| First post | 2012-07-12 08:59 +0000 |
| Last post | 2012-07-14 05:34 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Algorithm Analysis Course: Should I use Mathematica for projects? "djmpark" <djmpark@comcast.net> - 2012-07-12 08:59 +0000
Re: Algorithm Analysis Course: Should I use Mathematica for projects? Richard Fateman <fateman@cs.berkeley.edu> - 2012-07-13 06:57 +0000
Re: Algorithm Analysis Course: Should I use Mathematica for projects? Andrzej Kozlowski <akozlowski@gmail.com> - 2012-07-14 05:32 +0000
Re: Algorithm Analysis Course: Should I use Mathematica for projects? "djmpark" <djmpark@comcast.net> - 2012-07-14 05:34 +0000
| From | "djmpark" <djmpark@comcast.net> |
|---|---|
| Date | 2012-07-12 08:59 +0000 |
| Subject | Re: Algorithm Analysis Course: Should I use Mathematica for projects? |
| Message-ID | <jtm3kl$gdm$1@smc.vnet.net> |
I'm not an expert at computer science so others may have something better to say there. But I think your "Pros" argument is correct. Mathematica is broad enough and deep enough that it is worthwhile getting good at it and it takes time. Are you aware of the book "Computer Science with Mathematica" by Roman E. Maeder. It was published in 2000 for Version 4, but is still probably plenty useful. David Park djmpark@comcast.net http://home.comcast.net/~djmpark/index.html From: Brentt [mailto:brenttnewman@gmail.com] Hi, I'm an undergrad math major, and taking a cross disciplinary Algorithm Analysis course in the fall. I talked to the professor and he said we can use whichever language we like and Mathematica would be fine if it had a way to evaluate run-time. Two questions: I think the required capabilities are those found in the documentation under "Time Measurement & Optimization". Would this be correct? And would those functions be adequate for an algorithm analysis course? I know this list would be a little biased but: should I use Mathematica? Cons: I absolutely adore Mathematica and never find myself wanting to program in anything else (I've toyed with Python and other languages, but Mathematica inspires me to play with programming like other languages have not), and thought committing to Python for the class might expand my programming skills. Also I'm guessing the course will focus on procedural algorithms which might not be a good fit for Mathematica's functional paradigm. I know Mathematica can be shoehorned in to any paradigm, but maybe it'd be better to use a more procedural language. Pros: I will learn Mathematica with more depth, and there are good reasons to get really good at one thing as opposed to OK at many things. Plus what I learn in Mathematica may just as well translate to other languages anyway so it may not be a big deal which I choose. Input anyone?
[toc] | [next] | [standalone]
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Date | 2012-07-13 06:57 +0000 |
| Message-ID | <jtogsj$qmh$1@smc.vnet.net> |
| In reply to | #10895 |
On 7/12/2012 1:59 AM, djmpark wrote:
> I'm not an expert at computer science so others may have something better to
> say there.
>
> But I think your "Pros" argument is correct. Mathematica is broad enough and
> deep enough that it is worthwhile getting good at it and it takes time.
>
> Are you aware of the book "Computer Science with Mathematica" by Roman E.
> Maeder. It was published in 2000 for Version 4, but is still probably plenty
> useful.
>
>
An example.
Create 3 arrays.
A=Table[i,{i,0,100}];
B=Table[i,{i,0,1000}];
Q=Table[i,{i,0,10000}];
Try updating the 50th element of each of these items, which look like
arrays in Mathematica.
Timing [A[[50]],{i,0,100000}]
Timing [B[[50]],{i,0,100000}]
Timing [Q[[50]],{i,0,100000}]
On my computer, these results take
0.266 seconds, 0.453 seconds, and 2.25 seconds,
So, for the prize, tell me which is the fastest, and which is the
slowest? Or more to the point, can you explain to your computer science
professor why this is so?
Now, instead of creating these guys as what appears to be arrays, one uses
A=Array[#&,100]
B=Array[#&,1000]
Q=Array[#&,10000]
How does that change the results?
Note that the documentation says. that "Array[f,n] generates a list of
length n with elements f[i]. Of course that is not really a list.
experimenting with Append and Prepend might be amusing too.
[toc] | [prev] | [next] | [standalone]
| From | Andrzej Kozlowski <akozlowski@gmail.com> |
|---|---|
| Date | 2012-07-14 05:32 +0000 |
| Message-ID | <jtr09p$be6$1@smc.vnet.net> |
| In reply to | #10895 |
On 13 Jul 2012, at 08:55, Richard Fateman wrote:
> On 7/12/2012 1:59 AM, djmpark wrote:
>> I'm not an expert at computer science so others may have something better to
>> say there.
>>
>> But I think your "Pros" argument is correct. Mathematica is broad enough and
>> deep enough that it is worthwhile getting good at it and it takes time.
>>
>> Are you aware of the book "Computer Science with Mathematica" by Roman E.
>> Maeder. It was published in 2000 for Version 4, but is still probably plenty
>> useful.
>>
>>
>
> An example.
>
> Create 3 arrays.
>
> A=Table[i,{i,0,100}];
> B=Table[i,{i,0,1000}];
> Q=Table[i,{i,0,10000}];
>
> Try updating the 50th element of each of these items, which look like
> arrays in Mathematica.
>
> Timing [A[[50]],{i,0,100000}]
>
> Timing [B[[50]],{i,0,100000}]
>
> Timing [Q[[50]],{i,0,100000}]
>
> On my computer, these results take
> 0.266 seconds, 0.453 seconds, and 2.25 seconds,
This must be a very remarkable computer indeed since on my computer I get:
In[1]:= A = Table[i, {i, 0, 100}];
B = Table[i, {i, 0, 1000}];
Q = Table[i, {i, 0, 10000}];
In[4]:= Timing[A[[50]], {i, 0, 100000}]
During evaluation of In[4]:= Timing::argx: Timing called with 2 arguments; 1 argument is expected. >>
Out[4]= Timing[A[[50]],{i,0,100000}]
I have to admit I am quite curious how this is going to turn out to be really Wolfram's fault.
Andrzej Kozlowski
[toc] | [prev] | [next] | [standalone]
| From | "djmpark" <djmpark@comcast.net> |
|---|---|
| Date | 2012-07-14 05:34 +0000 |
| Message-ID | <jtr0di$bei$1@smc.vnet.net> |
| In reply to | #10895 |
But there is a difference between developing and analyzing an algorithm and
running an algorithm on a particular machine. Unless one is going to do
empirical algorithmics Mathematica might still bring much better
capabilities to the subject matter.
David Park
djmpark@comcast.net
http://home.comcast.net/~djmpark/index.html
From: Richard Fateman [mailto:fateman@cs.berkeley.edu]
On 7/12/2012 1:59 AM, djmpark wrote:
> I'm not an expert at computer science so others may have something
> better to say there.
>
> But I think your "Pros" argument is correct. Mathematica is broad
> enough and deep enough that it is worthwhile getting good at it and it
takes time.
>
> Are you aware of the book "Computer Science with Mathematica" by Roman E.
> Maeder. It was published in 2000 for Version 4, but is still probably
> plenty useful.
>
>
An example.
Create 3 arrays.
A=Table[i,{i,0,100}];
B=Table[i,{i,0,1000}];
Q=Table[i,{i,0,10000}];
Try updating the 50th element of each of these items, which look like arrays
in Mathematica.
Timing [A[[50]],{i,0,100000}]
Timing [B[[50]],{i,0,100000}]
Timing [Q[[50]],{i,0,100000}]
On my computer, these results take
0.266 seconds, 0.453 seconds, and 2.25 seconds,
So, for the prize, tell me which is the fastest, and which is the slowest?
Or more to the point, can you explain to your computer science professor why
this is so?
Now, instead of creating these guys as what appears to be arrays, one uses
A=Array[#&,100]
B=Array[#&,1000]
Q=Array[#&,10000]
How does that change the results?
Note that the documentation says. that "Array[f,n] generates a list of
length n with elements f[i]. Of course that is not really a list.
experimenting with Append and Prepend might be amusing too.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web