/sqrtsimulation

Computes the nth root using Monte Carlo simulation

Primary LanguagePython

nth root simulation

Computes the nth root using monte carlo simulation in Python (GUI).

Problem to solve 📄

Since we need to find the umpteenth root of any number, then, be n the number to calculate, we create an interval [0, p] where p belongs to [sqrt (n-1), sqrt (n+1)]. We simulate the throwing of N darts in the initial interval and return the ratio of darts that belongs to interval where p is. That ratio is the searched value.

Input 📋

  • Numero de dardos: number of darts
  • Numero a aproximar: number to which the root will be calculated
  • Indice de la raiz: root grade
  • Grafica: graph
  • Error porcentual: percentage error

Output 📦

  • La aproximacion es: Simulated value
  • Error porcentual: percentage error
  • Valor real: real value