Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Very slow code' topicStudent Support Forum > General > "Very slow code"

Next Comment >Help | Reply To Topic
Author Comment/Response
Niko
09/20/11 6:53pm

Hey there.

At the moment I'm working on a SQUID experiment and I need to do some data-fitting, which is working very nice & quick, and some basic data transformation & plotting, which is horribly slow.

I put 3 cells in my notebook:

* first cell is defining the source data (normally by "Import" - sorry for scrollmania)
* second cell is doing my customized fit and plots the data used for fitting, and its fitted function (still working perfectly fast)
* third is doing some data transformation of the fitted data (depending on some parameters of the fit) and does a "ListPolarPlot" of it; which is taking ages...

The last cell goes like this:

P1polar := Table[{(P1data[[j]][[1]])*c, Abs[P1data[[j]][[2]] - a]} /. {P1nlm[[1]][[2]]}, {j, 1, Length[P1data]}];
ListPolarPlot[P1polar, PlotStyle -> Opacity[.25]]

*'P1data' is the list of fitted data
* 'c' and 'a' are parameters received by the fit (defined in 'P1nlm[[1]][[2]]')

It IS slow, you can see for yourself by executing the attached *.nb.
I suppose somewhere in this last part I coded some bollocks and Mathematica does the whole list-transforming iteration again for every point it plots...

I really have no clue and am eagerly anticipating your help.

Thank you alot,

Niko

Attachment: slow.nb, URL: ,

Subject (listing for 'Very slow code')
Author Date Posted
Very slow code Niko 09/20/11 6:53pm
Re: Very slow code yehuda 09/21/11 1:05pm
Next Comment >Help | Reply To Topic