2019-12-01 13:37:50 +0100 | received badge | ● Nice Question (source) |

2015-11-03 16:36:45 +0100 | received badge | ● Notable Question (source) |

2015-11-03 16:36:45 +0100 | received badge | ● Famous Question (source) |

2014-02-09 23:05:51 +0100 | received badge | ● Popular Question (source) |

2013-10-30 08:44:23 +0100 | commented answer | Speed comparison with numerical arrays: sage, R, matlab @kcrisman : That sounds like the right way to do it. Would you by chance be able to point to an example in one of the tutorials that does this in a best-practice way? I tend to confuse myself when converting objects from one class to another, which leads to a lot of overhead, as in my original example. (If you don't have an example at hand, then don't worry, I just had the idea that perhaps you could save me a lot of time) |

2013-10-29 03:45:29 +0100 | commented answer | Speed comparison with numerical arrays: sage, R, matlab @kcrisman - thanks for the pointer. Now, most of my code contains much symbolic manipulation before going to numerics, so that's why I tend to start in sage. I will have to do some experimentation ... |

2013-10-29 03:43:18 +0100 | commented answer | Speed comparison with numerical arrays: sage, R, matlab Thanks! I guess the take-home-message is to stay in numpy, whereas I was trying to do as much as possible in sage proper, and only shifting to numpy for bottlenecks. |

2013-10-29 03:39:39 +0100 | received badge | ● Supporter (source) |

2013-10-28 22:26:45 +0100 | received badge | ● Student (source) |

2013-10-28 18:52:08 +0100 | asked a question | Speed comparison with numerical arrays: sage, R, matlab Dear all I am a sage newbie coming from matlab, R, and Maple, and although I really like many features, I find that my sage code for handling numerical arrays is much more complex and much slower than the corresponding code in R and Matlab. Here's an example: ## Simuating a sample path of standard Brownian motionI want to simulate a random path of standard Brownian motion. The input is a vector of time points, and I want returned a (random) trajectory, sampled at these time points. To do this I need: 1) Fast random number generation 2) Fast array operations: Diff, multiplication, and cumsum. I found that in sage I need to go through NumPy, so I wrote: I then time it, testing with 1 million time points: I get a time of 3.5 seconds on my machine, a standard Laptop running Ubuntu, running sage from the shell. Using prun, I see that half of the time, roughly, is spent generating random numbers and the other half mainly constructing numerical arrays. For comparison, the R code would be (here I assume that tvec[1]=0) which executes in 0.24 seconds. The matlab code would be which runs in 0.06 seconds. You see that my sage code is not only clumsier, it is also between 10 and 100 times slower, so I guess I am doing something wrong. I would really appreciate if you could point me in the direction of cleaner and faster code. Cheers, Uffe |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.