I am having an issue with finding the entropy in my program. I was asked to the find the entropy of the distribution as a function of time but i do not know where to start with entropy.(adsbygoogle = window.adsbygoogle || []).push({});

I understand entropy but putting it in my program is where I am stuck

Here is my code:

Code (Python):# -*- coding: utf-8 -*-

"""

Created on Thu Nov 12 11:15:44 2015

"""

import matplotlib.pyplot as plt

import random

def Function(D): #D = dimensions

sumOfSquare = 0.0

for i in range(0, len(D)):

sumOfSquare += D[i]**2

if sumOfSquare <=1:

return 1

else:

return 0

def MonteCarlo(f_n,dim):

intervalsForSphere = 1000000

integral = 0.0

for i in range(0, intervalsForSphere):

for j in range(0,len(dim)):

dim[j] = random.random()

integral += f_n(dim)

integral = (1-(-1))**len(dim)/intervalsForSphere * integral

return integral

print("10 dimensional unit circle ")

Ten_Dim= list(range(1,10+1))

ten_D_circle = MonteCarlo(Function,Ten_Dim)

print("area:",ten_D_circle)

AreaofCircle = []

x = []

for i in range(1,13):

D = list(range(1,i+1))

AreaofCircle.append(MonteCarlo(Function, D))

x.append(i)

plt.plot(x,AreaofCircle)

plt.xlim([0,13])

plt.xlabel("Dimensions")

plt.ylabel("area")

plt.title("Area of N-dimensional Unit Circle")

plt.show()

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Entropy of the distribution as a function of time

Loading...

Similar Threads for Entropy distribution function |
---|

Surface plot for a 3D function |

Program that calculates the list of x and f(x) for a given function |

C/++/# Is Pass-by-Reference part of a Function Signature? |

Fortran Fortran external functions vs subroutines |

**Physics Forums | Science Articles, Homework Help, Discussion**