[Matplotlib-users] Fwd: bug report

2015-09-16 Thread Bobby Wilkins
OS: Windows 8.1 Pro

matplotlib version: 1.4.3

where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/

customizations: none

Sample Program: attached py file; this is a Physics homework problem; I
have the answers I need, but would like to fix the errors to be able to
label all lines.

Debug output in attached output.txt file

If you uncomment line 180, the error is reported as if it came from that
line even though there is no float64 on that line (savefig).  If commented,
it does not report a line from my .py file...

If you make line 170 read as follows, the error goes away:

if (maxTerm<32):

This suggests to me that the additional labels for the 32, 64, 128, and 154
term runs is what is triggering the bug, but I cannot figure out what it
is.

Also, separate note, just about any time I make figures, when closing the
last figure I get a python.exe app crash and this message:

alloc: invalid block: 044E7680: 0 d


Thank you for any help,
Bobby
# +++++++++++++++-
# Problem #4 - Compare e^-x to 1/e^x using Taylor-Series approximation. Use
# the error calculation to compare them.
# +++++++++++++++-
# Taylor Series for e^x
#
#  234
#  x  xxx
# e = 1 + x + -- + -- + -- ...
# 2!   3!   4!
#
# Taylor Series for e^-x
#
#   234
#  -x  xxx
# e  = 1 - x + -- - -- + -- ...
#  2!   3!   4!
#
# Error calculation
#   1 -x
# - - system e
# x
# calculated e
# --
# -x
# system e
# +++++++++++++++-
#
# +++++++++++++++-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches


def graphMyetoNegX(maxSlices,maxTerm,myRangeStart,myRangeEnd,myFigBase):
# Initial Values

# ONE
myfpOne = np.float64(1)
myfpZero= np.float64(0)

# My "x" array, spaced lineraly from 0 to 100
myX   = np.linspace(myRangeStart, myRangeEnd, maxSlices)

# I note that the numerator is an increasing power of x (from 0 to the 
number
# of iterations), so I start the numerator array as all "1"s to represent 
x^0
top   = np.repeat(np.array([[myfpOne]]), maxSlices)
negtop= np.repeat(np.array([[myfpOne]]), maxSlices)

# I note that the denominator is simply the previous denominator multiplied 
by
# the current iteration count: n! = (n-1)! * n, so start it at 0! == 1
bottom= np.repeat(np.array([[myfpOne]]), maxSlices)  # 0!

# The initial e^x = the initial numerator divided by the initial denominator
etoX  = top/bottom
etoNegX   = negtop/bottom

# I need to have a "previous e^x" to compare and know when I have reached a
# steady-state
lastetoX  = np.repeat(np.array([[myfpZero]]), maxSlices)
lastetoNegX   = np.repeat(np.array([[myfpZero]]), maxSlices)

# For counting consecutive identical results
consecetoXSame= 0
consecetoNegXSame = 0

# I start at step 0 to allow the first iteration to be 1
myNumSteps= 0

# Loop until I reach maxTerm
while (myNumSteps < maxTerm):
# Keep a copy of previous e^x (had to learn that a copy was needed)
lastetoX= np.copy(etoX)
lastetoNegX= np.copy(etoNegX)

# Multiply numerator array by x array again
top*= myX
negtop *= -myX

# Increment iteration counter
myNumSteps += 1

# Multiply denominator by iteration counter (progress the n!)
bottom *= myNumSteps

# Find the new fraction to add; not strictly necessary, but helps with
# debugging
thisTerm= top/bottom
thatTerm= negtop/bottom

# Add this term to the e^x
etoX   += thisTerm
etoNegX+= thatTerm

# Test array equality (steady-state) and report if so
if np.array_equal(lastetoX,etoX) == True:
consecetoXSame+=1
if consecetoXSame>1:
consecstr=str(consecetoXSame)+" times."
else:
consecstr="once."
#print("No change in calculated e^x,",etoX,"vs 
previous,",lastetoX,consecstr)
else:
consecetoXSame=0

if np.array_equal(lastetoNegX,etoNegX) == True:
consecetoNegXSame+=1
if consecetoNegXSame>1:
consecstr=str(consecetoNegXSame)+" times."
else:
consecstr="once."
#print("No change in calculated e^x,",etoNegX,"vs 
previous,",lastetoNegX,consecstr)
else:
consecetoNegXSame=0

# ++++++++++

Re: [Matplotlib-users] Fwd: bug report

2015-09-16 Thread Benjamin Root
What version of numpy do you have installed?

On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins 
wrote:

> OS: Windows 8.1 Pro
>
> matplotlib version: 1.4.3
>
> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
>
> customizations: none
>
> Sample Program: attached py file; this is a Physics homework problem; I
> have the answers I need, but would like to fix the errors to be able to
> label all lines.
>
> Debug output in attached output.txt file
>
> If you uncomment line 180, the error is reported as if it came from that
> line even though there is no float64 on that line (savefig).  If commented,
> it does not report a line from my .py file...
>
> If you make line 170 read as follows, the error goes away:
>
> if (maxTerm<32):
>
> This suggests to me that the additional labels for the 32, 64, 128, and
> 154 term runs is what is triggering the bug, but I cannot figure out what
> it is.
>
> Also, separate note, just about any time I make figures, when closing the
> last figure I get a python.exe app crash and this message:
>
> alloc: invalid block: 044E7680: 0 d
>
>
> Thank you for any help,
> Bobby
>
>
>
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: bug report

2015-09-16 Thread Benjamin Root
Btw, I can't reproduce the problem using matplotlib master, numpy master
and linux. I know it isn't at all similar to your setup, but it is a data
point.

On Wed, Sep 16, 2015 at 9:43 AM, Benjamin Root  wrote:

> What version of numpy do you have installed?
>
> On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins 
> wrote:
>
>> OS: Windows 8.1 Pro
>>
>> matplotlib version: 1.4.3
>>
>> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
>>
>> customizations: none
>>
>> Sample Program: attached py file; this is a Physics homework problem; I
>> have the answers I need, but would like to fix the errors to be able to
>> label all lines.
>>
>> Debug output in attached output.txt file
>>
>> If you uncomment line 180, the error is reported as if it came from that
>> line even though there is no float64 on that line (savefig).  If commented,
>> it does not report a line from my .py file...
>>
>> If you make line 170 read as follows, the error goes away:
>>
>> if (maxTerm<32):
>>
>> This suggests to me that the additional labels for the 32, 64, 128, and
>> 154 term runs is what is triggering the bug, but I cannot figure out what
>> it is.
>>
>> Also, separate note, just about any time I make figures, when closing the
>> last figure I get a python.exe app crash and this message:
>>
>> alloc: invalid block: 044E7680: 0 d
>>
>>
>> Thank you for any help,
>> Bobby
>>
>>
>>
>> --
>> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
>> Get real-time metrics from all of your servers, apps and tools
>> in one place.
>> SourceForge users - Click here to start your Free Trial of Datadog now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug report

2015-09-16 Thread Sterling Smith
Works fine for

{{{
 : python 
Python 2.7.10 (default, Sep 15 2015, 11:26:42) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
/Users/smithsp/.pyhistory
>>> import matplotlib
>>> matplotlib.__version__
'1.4.3'
>>> import numpy
>>> numpy.__version__
'1.9.2'
>>> matplotlib.get_backend()
u’MacOSX'
}}}

All are obtained through MacPorts on OSX 10.9.5.

-Sterling



On Sep 16, 2015, at 6:50AM, Benjamin Root  wrote:

> Btw, I can't reproduce the problem using matplotlib master, numpy master and 
> linux. I know it isn't at all similar to your setup, but it is a data point.
> 
> On Wed, Sep 16, 2015 at 9:43 AM, Benjamin Root  wrote:
> What version of numpy do you have installed?
> 
> On Wed, Sep 16, 2015 at 5:35 AM, Bobby Wilkins  
> wrote:
> OS: Windows 8.1 Pro
> 
> matplotlib version: 1.4.3
> 
> where obtained: http://www.lfd.uci.edu/~gohlke/pythonlibs/
> 
> customizations: none
> 
> Sample Program: attached py file; this is a Physics homework problem; I have 
> the answers I need, but would like to fix the errors to be able to label all 
> lines.
> 
> Debug output in attached output.txt file
> 
> If you uncomment line 180, the error is reported as if it came from that line 
> even though there is no float64 on that line (savefig).  If commented, it 
> does not report a line from my .py file...
> 
> If you make line 170 read as follows, the error goes away:
> 
> if (maxTerm<32):
> 
> This suggests to me that the additional labels for the 32, 64, 128, and 154 
> term runs is what is triggering the bug, but I cannot figure out what it is. 
> 
> Also, separate note, just about any time I make figures, when closing the 
> last figure I get a python.exe app crash and this message:
> 
> alloc: invalid block: 044E7680: 0 d
> 
> 
> Thank you for any help,
> Bobby
> 
> 
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
> --
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users