On 25 April 2016 at 15:35, Derek Klinge wrote:
>
> Although I see the value of relative error, I am just as interested in
> absolute error (though admittedly they are directly related values).
I was referring to relative error because the relative error is the
same at each step making the calcula
A couple thoughts. I think my original approach would be faster than binary
search for finding the minimum value of N needed to get a decimal level of
absolute accuracy from Euler's number. Here is my reasoning:
EulerlersNumber(13).LimitMethod() - math.e < .1 and
EulersNumber(135).LimitMethod - mat
On 25 April 2016 at 08:39, Gregory Ewing wrote:
> Derek Klinge wrote:
>>
>> Also, it seems to me if the goal is to use the smallest value of n to get
>> a
>> particular level of accuracy, changing your guess of N by doubling seems
>> to
>> have a high chance of overshoot.
>
>
> If you want to find
Derek Klinge wrote:
> I found that the pattern of an additional digit of accuracy corresponding
> to 10*n did not hold as strongly for that value (I can post data if
> desired). I also got some results that seem to contradict the mathematical
> definition. For example try EulersNumber(10**15).Limi
Derek Klinge wrote:
Also, it seems to me if the goal is to use the smallest value of n to get a
particular level of accuracy, changing your guess of N by doubling seems to
have a high chance of overshoot.
If you want to find the exact n required, once you overshoot
you could use a binary search
So I tried the recommended limit approach and got some interesting results.
## Write a method to approximate Euler's Number using Euler's Method
import math
class EulersNumber():
def __init__(self,n):
self.n = n
self.e = 2
def linearApproximation(self,x,h,d): # f(x+h)=f(x)+h*f'(x)
return x + h *
Actually, I'm not trying to speed it up, just be able to handle a large
number of n.
(Thank you Chris for the suggestion to use xrange, I am on a Mac using the
stock Python 2.7)
I am looking at the number of iterations of linear approximation that are
required to get a more accurate representation
On 24 April 2016 at 19:21, Chris Angelico wrote:
> On Mon, Apr 25, 2016 at 4:03 AM, Derek Klinge wrote:
>> Ok, from the gmail web client:
>
> Bouncing this back to the list, and removing quote markers for other
> people's copy/paste convenience.
>
> ## Write a method to approximate Euler's Number
On Mon, Apr 25, 2016 at 4:03 AM, Derek Klinge wrote:
> Ok, from the gmail web client:
Bouncing this back to the list, and removing quote markers for other
people's copy/paste convenience.
## Write a method to approximate Euler's Number using Euler's Method
import math
class EulersNumber():
On Mon, Apr 25, 2016 at 3:56 AM, Derek Klinge wrote:
> Doesn't range(n) create a list n long?
Not in Python 3. If your code is running on Python 2, use xrange
instead of range. I rather doubt that's your problem, though.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Doesn't range(n) create a list n long?
On Sun, Apr 24, 2016 at 10:21 AM Chris Angelico wrote:
> On Mon, Apr 25, 2016 at 3:02 AM, Derek Klinge
> wrote:
> > My problem is this: my attempt at Euler's Method involves creating a
> list of
> > numbers that is n long. Is there a way I can iterate over
On Mon, Apr 25, 2016 at 3:02 AM, Derek Klinge wrote:
> My problem is this: my attempt at Euler's Method involves creating a list of
> numbers that is n long. Is there a way I can iterate over the linear
> approximation method without creating a list of steps (maybe recursion, I am
> a bit new at t
On Mon, Apr 25, 2016 at 3:06 AM, Derek Klinge wrote:
> I think my e-mail client may be stripping the indentation, here it is with
> 4-space indentation
I think it is. Both your reposted versions have indentation lost. You
may need to use a different client.
My posts come from the Gmail web clien
I think my e-mail client may be stripping the indentation, here it is with
4-space indentation
## Write a method to approximate Euler's Number using Euler's Method
import math
class EulersNumber():
def __init__(self,n):
self.eulerSteps = n
self.e = self.EulersMethod(self.eulerSteps)
def linearApp
Sorry about the code indentation, I was using Pythonista (iOS), and it did
not have any problem with that indentation...
Here is a new set of the code:
## Write a method to approximate Euler's Number using Euler's Method
import math
class EulersNumber():
def __init__(self,n):
self.eulerSteps = n
On Sun, Apr 24, 2016 at 1:05 PM, Derek Klinge wrote:
> I have been writing a python script to explore Euler's Method of
> approximating Euler's Number. I was hoping there might be a way to make
> this process work faster, as for sufficiently large eulerSteps, the process
> below becomes quite slow
I have been writing a python script to explore Euler's Method of
approximating Euler's Number. I was hoping there might be a way to make
this process work faster, as for sufficiently large eulerSteps, the process
below becomes quite slow and sometimes memory intensive. I'm hoping someone
can give m
17 matches
Mail list logo