Message Boards Message Boards

0
|
3434 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Improve this process to model the intersections of the diffusion of sperm?

Posted 6 years ago

I am trying to make code modeling the intersections (defined by methods using integration) of the diffusion of sperm and egg graphs at all points in time (so more integration was used) with respect to different distances.

The derivation of this process should not matter, but rather my problem is that I have run this code for days to no avail.

Integrating over time for each graph gives the expected percentage of zygotes formed for each distance. My goal is to obtain these values and plot the results. Here is my code:

s[x_, y_, t_] = (1/(Sqrt[4*Pi*t])^3)*
   E^((-(x + 0)^2 - (y + 0)^2)/(4*t));
e[x_, y_, t_, d_] = (1/(Sqrt[4*Pi*t])^3)*
   E^((-(x + d)^2 - (y + d)^2)/(4*t));
f2D[sc_, t_] = N[(171.153*sc - 0.149*t + 31.334)/100];
xcoord = Table[g, {g, 1, 100, 9}]
    upper[d_] := 
      t /. First@
        NSolve[N[(N[
              Integrate[
               If[s[x, y, t] > 0 && 
                 e[x, y, t, d] > 0, (e[x, y, t, d] + s[x, y, t])*
                 f2D[s[x, y, t], t], 
                0], {x, -\[Infinity], \[Infinity]}, {y, -\[Infinity], \
    \[Infinity]}]])/(2*
              N[Integrate[
                1, {x, -\[Infinity], \[Infinity]}, {y, -\[Infinity], \
    \[Infinity]}, {z, 0, s[x, y, t]}]])] == 0, t, Reals];
   function = 
     N[Integrate[(N[
          Integrate[
           If[s[x, y, t] > 0 && 
             e[x, y, t, d] > 0, (e[x, y, t, d] + s[x, y, t])*
             f2D[s[x, y, t], t], 
            0], {x, -\[Infinity], \[Infinity]}, {y, -\[Infinity], \
    \[Infinity]}]])/(2*
          N[Integrate[
            1, {x, -\[Infinity], \[Infinity]}, {y, -\[Infinity], \
    \[Infinity]}, {z, 0, s[x, y, t]}]]), {t, 1, upper[d]}]]
    ycoord = Table[function, {d, 1, 100, 9}]
    sorted = Riffle[xcoord, ycoord];
    coords = {First[#], Part[#, 2]} & /@ Split[sorted]
    ListPlot[coords]

The first output for the x-coordinates were easily listed, but the next piece of code has not finished running.

It is important to mention that running the function on its own—albeit, with a specified distance—has outputted data for the integration over all times at that distance. Furthermore, the percentage of zygotes at a distance d is defined as the integration over the times from 1 to A where A represents the time where the probability of fertilization at time A = 0 (probability becomes negative after that).

Is there any way to yield results faster? Is there an error in my code to find the time A?

Any assistance would be highly appreciated!

EDIT: I added the full code (all equations denoted)

POSTED BY: Vinny Pagano
2 Replies

The code appears to be incomplete in that some functions it requires are not present.

POSTED BY: Daniel Lichtblau
Posted 6 years ago

Thank you for that. I will update the post.

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

Group Abstract Group Abstract