Python implementation of approximating the chance a particle is at a location after n steps in the cardinal directionsPython implementation of the longest increasing subsequence“Cut the sticks” Python implementationctypes implementation in PythonPython Octree ImplementationAdvent of Code - Day 01Find the longest rectilinear path in a matrix with descending entriesImplementation of the Householder TransformationAnalyzing the U.S. Births dataset in PythonSearching for the location of a sub-image within an imageComputing the autocorrelation between 2D time series arrays in python

What can I do if I am asked to learn different programming languages very frequently?

What if (if any) the reason to buy in small local stores?

A Ri-diddley-iley Riddle

What exactly term 'companion plants' means?

Could Sinn Fein swing any Brexit vote in Parliament?

Do native speakers use "ultima" and "proxima" frequently in spoken English?

How does one measure the Fourier components of a signal?

Constant Current LED Circuit

I got the following comment from a reputed math journal. What does it mean?

Help rendering a complicated sum/product formula

Can a medieval gyroplane be built?

In Aliens, how many people were on LV-426 before the Marines arrived​?

Comment Box for Substitution Method of Integrals

What are substitutions for coconut in curry?

Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?

What should I install to correct "ld: cannot find -lgbm and -linput" so that I can compile a Rust program?

Fewest number of steps to reach 200 using special calculator

How can my new character not be a role-playing handicap to the party?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

How do hiring committees for research positions view getting "scooped"?

Why is indicated airspeed rather than ground speed used during the takeoff roll?

Deletion of copy-ctor & copy-assignment - public, private or protected?

Should I use acronyms in dialogues before telling the readers what it stands for in fiction?

Recruiter wants very extensive technical details about all of my previous work



Python implementation of approximating the chance a particle is at a location after n steps in the cardinal directions


Python implementation of the longest increasing subsequence“Cut the sticks” Python implementationctypes implementation in PythonPython Octree ImplementationAdvent of Code - Day 01Find the longest rectilinear path in a matrix with descending entriesImplementation of the Householder TransformationAnalyzing the U.S. Births dataset in PythonSearching for the location of a sub-image within an imageComputing the autocorrelation between 2D time series arrays in python













0












$begingroup$


Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to see if there is any possible way that I can improve upon it.



The question reads as follows:



A particle starts at (0, 0) and moves in one unit independent
steps with equal probabilities of 1/4 in each of the four
directions: north, south, east, and west. Let S equal
the east-west position and T the north-south position
after n steps.


The code (and more information) can be found here in the GitHub repository.



The code is right here:
simulation.py



"""
A particle starts at (0, 0) and moves in one unit independent
steps with equal probabilities of 1/4 in each of the four
directions: north, south, east, and west. Let S equal
the east-west position and T the north-south position
after n steps.
"""

from random import choice

import numpy as np

from options import Options

# Directions (K -> V is initial of direction -> (dx, dy)
directions =
'S': (0, -1),
'N': (0, 1),
'E': (1, 0),
'W': (-1, 0)



def get_direction():
"""
Get a random direction. Each direction has a 25% chance of occurring.

:returns: the chosen directions changes in x and y
"""
dirs = "NSEW"
return directions[choice(dirs)]


def change_position(curr_pos, change_in_pos):
"""
Updates the current location based on the change in position.

:returns: the update position (x, y)
"""
return curr_pos[0] + change_in_pos[0], curr_pos[1] + change_in_pos[1]


def increment_counter(counter, end_pos):
"""
Increments the provided counter at the given location.

:param counter: an numpy ndarray with the number of all ending locations in the simulation.
:param end_pos: the ending position of the last round of the simulation.
:returns: the updated counter.
"""
counter[end_pos[1], end_pos[0]] += 1
return counter


def get_chance_of_positions(n):
"""
Gets the approximated chance the particle ends at a given location.

Starting location is in the center of the output.

:param n: The number of steps the simulation is to take.
:returns: the number of iterations and an ndarray with the approximated chance the particle would be at each location.
"""
# The starting position starts at n, n so that we can pass in the location
# into the counter without worrying about negative numbers.
starting_pos = (n, n)

options = Options.get_options()

total_num_of_sims = options.num_of_rounds

counter = np.zeros(shape=(2 * n + 1, 2 * n + 1))

for j in range(total_num_of_sims):
curr_pos = starting_pos
for i in range(n):
change_in_pos = get_direction()
curr_pos = change_position(curr_pos, change_in_pos)
counter = increment_counter(counter, curr_pos)

chances = np.round(counter / total_num_of_sims, decimals=n + 1)
return total_num_of_sims, chances


plot.py



import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable

from simulation import get_chance_of_positions as get_chance
from options import Options

def plot(n):
"""
Saves the plots of the chance of positions from simulation.py
:param n: the number of steps the simulation will take.
"""
num_of_iterations, counter = get_chance(n)

fig = plt.figure()

ax = fig.add_subplot(111)
ax.set_title("Position Color Map (n = )".format(n))
ax.set_xlabel("Number of iterations: ".format(int(num_of_iterations)))

plt.imshow(counter, cmap=plt.get_cmap('Blues_r'))

ax.set_aspect('equal')

divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)

plt.colorbar(orientation='vertical', cax=cax)
fig.savefig('plots/plot-:03.png'.format(n), dpi=fig.dpi)


def main():
"""
The main function for this file. Makes max_n plots of the simulation.
"""
options = Options.get_options()

for n in range(1, options.num_of_sims + 1):
plot(n)


if __name__ == "__main__":
main()


options.py



import argparse

class Options:


options = None


@staticmethod
def generate_options():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-N', '--num-of-rounds',
type = int,
required = False,
default = 10**5,
help = "The number of rounds to run in each simulation. Should be a big number. Default is 1E5")
arg_parser.add_argument('-n', '--num-of-sims',
type = int,
required = False,
default = 10,
help = "The number of simulations (and plots) to run. Default is 10.")
return arg_parser.parse_args()


@staticmethod
def get_options():
if Options.options is None:
Options.options = Options.generate_options()
return Options.options


I would love for some recommendations on PEP 8, design, and "Pythonic" code (code that Python expects and will thus be better optimized, such as list comprehension and numpy optimizations, wherever they may be.)










share|improve this question







New contributor




user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$
















    0












    $begingroup$


    Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to see if there is any possible way that I can improve upon it.



    The question reads as follows:



    A particle starts at (0, 0) and moves in one unit independent
    steps with equal probabilities of 1/4 in each of the four
    directions: north, south, east, and west. Let S equal
    the east-west position and T the north-south position
    after n steps.


    The code (and more information) can be found here in the GitHub repository.



    The code is right here:
    simulation.py



    """
    A particle starts at (0, 0) and moves in one unit independent
    steps with equal probabilities of 1/4 in each of the four
    directions: north, south, east, and west. Let S equal
    the east-west position and T the north-south position
    after n steps.
    """

    from random import choice

    import numpy as np

    from options import Options

    # Directions (K -> V is initial of direction -> (dx, dy)
    directions =
    'S': (0, -1),
    'N': (0, 1),
    'E': (1, 0),
    'W': (-1, 0)



    def get_direction():
    """
    Get a random direction. Each direction has a 25% chance of occurring.

    :returns: the chosen directions changes in x and y
    """
    dirs = "NSEW"
    return directions[choice(dirs)]


    def change_position(curr_pos, change_in_pos):
    """
    Updates the current location based on the change in position.

    :returns: the update position (x, y)
    """
    return curr_pos[0] + change_in_pos[0], curr_pos[1] + change_in_pos[1]


    def increment_counter(counter, end_pos):
    """
    Increments the provided counter at the given location.

    :param counter: an numpy ndarray with the number of all ending locations in the simulation.
    :param end_pos: the ending position of the last round of the simulation.
    :returns: the updated counter.
    """
    counter[end_pos[1], end_pos[0]] += 1
    return counter


    def get_chance_of_positions(n):
    """
    Gets the approximated chance the particle ends at a given location.

    Starting location is in the center of the output.

    :param n: The number of steps the simulation is to take.
    :returns: the number of iterations and an ndarray with the approximated chance the particle would be at each location.
    """
    # The starting position starts at n, n so that we can pass in the location
    # into the counter without worrying about negative numbers.
    starting_pos = (n, n)

    options = Options.get_options()

    total_num_of_sims = options.num_of_rounds

    counter = np.zeros(shape=(2 * n + 1, 2 * n + 1))

    for j in range(total_num_of_sims):
    curr_pos = starting_pos
    for i in range(n):
    change_in_pos = get_direction()
    curr_pos = change_position(curr_pos, change_in_pos)
    counter = increment_counter(counter, curr_pos)

    chances = np.round(counter / total_num_of_sims, decimals=n + 1)
    return total_num_of_sims, chances


    plot.py



    import matplotlib.pyplot as plt
    from mpl_toolkits.axes_grid1 import make_axes_locatable

    from simulation import get_chance_of_positions as get_chance
    from options import Options

    def plot(n):
    """
    Saves the plots of the chance of positions from simulation.py
    :param n: the number of steps the simulation will take.
    """
    num_of_iterations, counter = get_chance(n)

    fig = plt.figure()

    ax = fig.add_subplot(111)
    ax.set_title("Position Color Map (n = )".format(n))
    ax.set_xlabel("Number of iterations: ".format(int(num_of_iterations)))

    plt.imshow(counter, cmap=plt.get_cmap('Blues_r'))

    ax.set_aspect('equal')

    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.05)

    plt.colorbar(orientation='vertical', cax=cax)
    fig.savefig('plots/plot-:03.png'.format(n), dpi=fig.dpi)


    def main():
    """
    The main function for this file. Makes max_n plots of the simulation.
    """
    options = Options.get_options()

    for n in range(1, options.num_of_sims + 1):
    plot(n)


    if __name__ == "__main__":
    main()


    options.py



    import argparse

    class Options:


    options = None


    @staticmethod
    def generate_options():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument('-N', '--num-of-rounds',
    type = int,
    required = False,
    default = 10**5,
    help = "The number of rounds to run in each simulation. Should be a big number. Default is 1E5")
    arg_parser.add_argument('-n', '--num-of-sims',
    type = int,
    required = False,
    default = 10,
    help = "The number of simulations (and plots) to run. Default is 10.")
    return arg_parser.parse_args()


    @staticmethod
    def get_options():
    if Options.options is None:
    Options.options = Options.generate_options()
    return Options.options


    I would love for some recommendations on PEP 8, design, and "Pythonic" code (code that Python expects and will thus be better optimized, such as list comprehension and numpy optimizations, wherever they may be.)










    share|improve this question







    New contributor




    user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$














      0












      0








      0





      $begingroup$


      Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to see if there is any possible way that I can improve upon it.



      The question reads as follows:



      A particle starts at (0, 0) and moves in one unit independent
      steps with equal probabilities of 1/4 in each of the four
      directions: north, south, east, and west. Let S equal
      the east-west position and T the north-south position
      after n steps.


      The code (and more information) can be found here in the GitHub repository.



      The code is right here:
      simulation.py



      """
      A particle starts at (0, 0) and moves in one unit independent
      steps with equal probabilities of 1/4 in each of the four
      directions: north, south, east, and west. Let S equal
      the east-west position and T the north-south position
      after n steps.
      """

      from random import choice

      import numpy as np

      from options import Options

      # Directions (K -> V is initial of direction -> (dx, dy)
      directions =
      'S': (0, -1),
      'N': (0, 1),
      'E': (1, 0),
      'W': (-1, 0)



      def get_direction():
      """
      Get a random direction. Each direction has a 25% chance of occurring.

      :returns: the chosen directions changes in x and y
      """
      dirs = "NSEW"
      return directions[choice(dirs)]


      def change_position(curr_pos, change_in_pos):
      """
      Updates the current location based on the change in position.

      :returns: the update position (x, y)
      """
      return curr_pos[0] + change_in_pos[0], curr_pos[1] + change_in_pos[1]


      def increment_counter(counter, end_pos):
      """
      Increments the provided counter at the given location.

      :param counter: an numpy ndarray with the number of all ending locations in the simulation.
      :param end_pos: the ending position of the last round of the simulation.
      :returns: the updated counter.
      """
      counter[end_pos[1], end_pos[0]] += 1
      return counter


      def get_chance_of_positions(n):
      """
      Gets the approximated chance the particle ends at a given location.

      Starting location is in the center of the output.

      :param n: The number of steps the simulation is to take.
      :returns: the number of iterations and an ndarray with the approximated chance the particle would be at each location.
      """
      # The starting position starts at n, n so that we can pass in the location
      # into the counter without worrying about negative numbers.
      starting_pos = (n, n)

      options = Options.get_options()

      total_num_of_sims = options.num_of_rounds

      counter = np.zeros(shape=(2 * n + 1, 2 * n + 1))

      for j in range(total_num_of_sims):
      curr_pos = starting_pos
      for i in range(n):
      change_in_pos = get_direction()
      curr_pos = change_position(curr_pos, change_in_pos)
      counter = increment_counter(counter, curr_pos)

      chances = np.round(counter / total_num_of_sims, decimals=n + 1)
      return total_num_of_sims, chances


      plot.py



      import matplotlib.pyplot as plt
      from mpl_toolkits.axes_grid1 import make_axes_locatable

      from simulation import get_chance_of_positions as get_chance
      from options import Options

      def plot(n):
      """
      Saves the plots of the chance of positions from simulation.py
      :param n: the number of steps the simulation will take.
      """
      num_of_iterations, counter = get_chance(n)

      fig = plt.figure()

      ax = fig.add_subplot(111)
      ax.set_title("Position Color Map (n = )".format(n))
      ax.set_xlabel("Number of iterations: ".format(int(num_of_iterations)))

      plt.imshow(counter, cmap=plt.get_cmap('Blues_r'))

      ax.set_aspect('equal')

      divider = make_axes_locatable(ax)
      cax = divider.append_axes("right", size="5%", pad=0.05)

      plt.colorbar(orientation='vertical', cax=cax)
      fig.savefig('plots/plot-:03.png'.format(n), dpi=fig.dpi)


      def main():
      """
      The main function for this file. Makes max_n plots of the simulation.
      """
      options = Options.get_options()

      for n in range(1, options.num_of_sims + 1):
      plot(n)


      if __name__ == "__main__":
      main()


      options.py



      import argparse

      class Options:


      options = None


      @staticmethod
      def generate_options():
      arg_parser = argparse.ArgumentParser()
      arg_parser.add_argument('-N', '--num-of-rounds',
      type = int,
      required = False,
      default = 10**5,
      help = "The number of rounds to run in each simulation. Should be a big number. Default is 1E5")
      arg_parser.add_argument('-n', '--num-of-sims',
      type = int,
      required = False,
      default = 10,
      help = "The number of simulations (and plots) to run. Default is 10.")
      return arg_parser.parse_args()


      @staticmethod
      def get_options():
      if Options.options is None:
      Options.options = Options.generate_options()
      return Options.options


      I would love for some recommendations on PEP 8, design, and "Pythonic" code (code that Python expects and will thus be better optimized, such as list comprehension and numpy optimizations, wherever they may be.)










      share|improve this question







      New contributor




      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to see if there is any possible way that I can improve upon it.



      The question reads as follows:



      A particle starts at (0, 0) and moves in one unit independent
      steps with equal probabilities of 1/4 in each of the four
      directions: north, south, east, and west. Let S equal
      the east-west position and T the north-south position
      after n steps.


      The code (and more information) can be found here in the GitHub repository.



      The code is right here:
      simulation.py



      """
      A particle starts at (0, 0) and moves in one unit independent
      steps with equal probabilities of 1/4 in each of the four
      directions: north, south, east, and west. Let S equal
      the east-west position and T the north-south position
      after n steps.
      """

      from random import choice

      import numpy as np

      from options import Options

      # Directions (K -> V is initial of direction -> (dx, dy)
      directions =
      'S': (0, -1),
      'N': (0, 1),
      'E': (1, 0),
      'W': (-1, 0)



      def get_direction():
      """
      Get a random direction. Each direction has a 25% chance of occurring.

      :returns: the chosen directions changes in x and y
      """
      dirs = "NSEW"
      return directions[choice(dirs)]


      def change_position(curr_pos, change_in_pos):
      """
      Updates the current location based on the change in position.

      :returns: the update position (x, y)
      """
      return curr_pos[0] + change_in_pos[0], curr_pos[1] + change_in_pos[1]


      def increment_counter(counter, end_pos):
      """
      Increments the provided counter at the given location.

      :param counter: an numpy ndarray with the number of all ending locations in the simulation.
      :param end_pos: the ending position of the last round of the simulation.
      :returns: the updated counter.
      """
      counter[end_pos[1], end_pos[0]] += 1
      return counter


      def get_chance_of_positions(n):
      """
      Gets the approximated chance the particle ends at a given location.

      Starting location is in the center of the output.

      :param n: The number of steps the simulation is to take.
      :returns: the number of iterations and an ndarray with the approximated chance the particle would be at each location.
      """
      # The starting position starts at n, n so that we can pass in the location
      # into the counter without worrying about negative numbers.
      starting_pos = (n, n)

      options = Options.get_options()

      total_num_of_sims = options.num_of_rounds

      counter = np.zeros(shape=(2 * n + 1, 2 * n + 1))

      for j in range(total_num_of_sims):
      curr_pos = starting_pos
      for i in range(n):
      change_in_pos = get_direction()
      curr_pos = change_position(curr_pos, change_in_pos)
      counter = increment_counter(counter, curr_pos)

      chances = np.round(counter / total_num_of_sims, decimals=n + 1)
      return total_num_of_sims, chances


      plot.py



      import matplotlib.pyplot as plt
      from mpl_toolkits.axes_grid1 import make_axes_locatable

      from simulation import get_chance_of_positions as get_chance
      from options import Options

      def plot(n):
      """
      Saves the plots of the chance of positions from simulation.py
      :param n: the number of steps the simulation will take.
      """
      num_of_iterations, counter = get_chance(n)

      fig = plt.figure()

      ax = fig.add_subplot(111)
      ax.set_title("Position Color Map (n = )".format(n))
      ax.set_xlabel("Number of iterations: ".format(int(num_of_iterations)))

      plt.imshow(counter, cmap=plt.get_cmap('Blues_r'))

      ax.set_aspect('equal')

      divider = make_axes_locatable(ax)
      cax = divider.append_axes("right", size="5%", pad=0.05)

      plt.colorbar(orientation='vertical', cax=cax)
      fig.savefig('plots/plot-:03.png'.format(n), dpi=fig.dpi)


      def main():
      """
      The main function for this file. Makes max_n plots of the simulation.
      """
      options = Options.get_options()

      for n in range(1, options.num_of_sims + 1):
      plot(n)


      if __name__ == "__main__":
      main()


      options.py



      import argparse

      class Options:


      options = None


      @staticmethod
      def generate_options():
      arg_parser = argparse.ArgumentParser()
      arg_parser.add_argument('-N', '--num-of-rounds',
      type = int,
      required = False,
      default = 10**5,
      help = "The number of rounds to run in each simulation. Should be a big number. Default is 1E5")
      arg_parser.add_argument('-n', '--num-of-sims',
      type = int,
      required = False,
      default = 10,
      help = "The number of simulations (and plots) to run. Default is 10.")
      return arg_parser.parse_args()


      @staticmethod
      def get_options():
      if Options.options is None:
      Options.options = Options.generate_options()
      return Options.options


      I would love for some recommendations on PEP 8, design, and "Pythonic" code (code that Python expects and will thus be better optimized, such as list comprehension and numpy optimizations, wherever they may be.)







      python numpy statistics matplotlib






      share|improve this question







      New contributor




      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 10 mins ago









      user3847149user3847149

      1




      1




      New contributor




      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user3847149 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "196"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          user3847149 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215632%2fpython-implementation-of-approximating-the-chance-a-particle-is-at-a-location-af%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user3847149 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          user3847149 is a new contributor. Be nice, and check out our Code of Conduct.












          user3847149 is a new contributor. Be nice, and check out our Code of Conduct.











          user3847149 is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215632%2fpython-implementation-of-approximating-the-chance-a-particle-is-at-a-location-af%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

          Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

          Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar