Group Abstract Group Abstract

Message Boards Message Boards

DensityPlot3D working too slowly - How to make it faster?

Posted 6 years ago

I think it because it plots a function that find fit-parameter to not-small data. the only thing that help me get the plot in a reasonable time is to set PlotPoints->10, but when I go to PlotPoints->50 for more precise plot, it runs for hours. Is there other way to quicken the program?

This is my code:

t1Fitting[x_?NumericQ, y_?NumericQ, z_?NumericQ] := Module[{sol, data, fit, P1, P2, t, a},
  sol = DSolve[{P1'[t] == -(2 y + x) P1[t] + (x - y) P2[t] + y
                P2'[t] == -(2 z + x) P2[t] + (x - z) P1[t] + z, 
                  P1[0] == 1, P2[0] == 0}, {P1, P2}, t];
      data = Flatten[
        Transpose[Table[N[P1[t] - P2[t] /. sol, 15], {t, 0, 25000, 10}]]];
      fit = FindFit[data, Exp[-a t],a, t, WorkingPrecision -> 10];
      a /. fit]

    t1Plot = DensityPlot3D[t1Fitting[x,y,z],{x, 10^-6, 10^-4}, {y, 10^-6, 10^-4}, {z, 10^-6, 10^-4}, PlotPoints -> 50]
POSTED BY: Sivan Harazi
3 Replies
Posted 6 years ago

The reason Iam fittinf exponential to a known function is because this is how people are measuring the system that I am looking at, and to know the values range of the parameters I use to describe this system (x, y, z), I must fit it this way.

POSTED BY: Sivan Harazi
POSTED BY: Neil Singer
Posted 6 years ago

Would it be feasible for you to test each of these (by restarting Mathematica each time and then doing a trivial calculation to start up the kernel and then using AbsoluteTiming) to see how much, if any, time each of these might save versus how much your graph is degraded?

Try substituting {t, 0, 25000, 100} or some other larger number for {t, 0, 25000, 10}

Try removing N[..., 15] to use perhaps faster machine precision calculations

Try removing WorkingPrecision->10 for the same reason

Try changing PlotPoints->10 to PlotPoints->20

The idea is to find which of those or which combination of those might give you enough increase in speed and still have satisfactory graphics resolution.

Are there missing _ between x? and between y? in your code or not? Those are different from your z_? Is there a comma missing in your code, perhaps because you had a newline between your two equations and when that was pasted that was lost?

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard