Implementing math in python
Due to my educational purposes (in math), I decided to write some programs that will be similar to MATLAB or python libraries (numpy, scipy). There is no attempt to create something new or for any use. I want to understand the mechanisms by implementing them in Python. Can you give any advices on tutorials or resources that will be useful? Or should I just follow the official documentation and trying to remake it?
Thanks a lot.
See also questions close to this topic

Python Kafka Streaming API  Binning
I am using python kafka stream binning example given in this, Python Kafka Streaming API
I am able to generate the data using generator.py file given under wintonkafkastreams/examples/binning/, whereas when i run the binning.py file from the same folder, i got the below issue. Could someone help me, to resolve this?

Change color of missing values in Seaborn heatmap
Consider the example of missing values in the Seaborn documentation:
corr = np.corrcoef(np.random.randn(10, 200)) mask = np.zeros_like(corr) mask[np.triu_indices_from(mask)] = True sns.heatmap(corr, mask=mask, vmax=.3, square=True)
How do I change the color of the missing values to, for example, black? The color of the missing values should be specified independent of the color scheme of the heatmap, it may not be present in the color scheme.
I tried adding
facecolor = 'black'
but that didn't work. The color can be affected by e.g.sns.axes_style("white")
but it isn't clear to me how that can be used to set an arbitrary color. 
Xpath + Scrapy + Python : data point couldn't be scraped
This is the XML structure:
<tr> <td> <font size="3"> <strong>Location:</strong> Hiranandani Gardens, Powai </font> </td> </tr>
I want to extract : Hiranandani Gardens, Powai
I tried with these:
response.xpath('//font[@size="3"]/strong[text()="Location:"]/text()').extract() response.xpath('//font[@size="3"]/strong[text()="Location:"]').extract()
Both returned an empty list.
Note: we must have to use the text of tag, i.e., "Location:". Otherwise, there are many other places on the site where the same XML structure is used. So, it'll fetch many more unnecessary things apart from the desired value if the text of strong tag is not used.

scala: using function definitions
In the code below, the first function compiles. The second doesn't compile.
type FTDoubleDouble_Double = (Double, Double) => Double val _dividedBy: FTDoubleDouble_Double = { _ / _.toDouble } val _dividedByThenLog: FTDoubleDouble_Double = { val result1 = _ / _.toDouble scala.math.log(result1) }
The compilation error is
cannot resolve symbol /
I am sure this is basic, but I am a bit confused.

Best way to calculate Bernoulli's nTh numbers in C with CodeBlocks on Windows 10 Pro
Good night, I'm working in a project that needs to calculate the Bernoulli numbers for nTh order. I tried exhaustively a lot of algorithms on internet, mostly it's in C++ what's not usefull for me. And always I'd got compilations erros or the wrong results to the numbers! What is the fastest way to calculate it? Odd's numbers is always 0.00000 and I need to calculate for any even numbers... I just need the result of the number I put on the function, don't need to list the numbers until the nTh like every algorithm I saw on the internet does. The last I tried that had compilation erros and after fixed give me wrong answers above... Yes, for people that will ask me if I put the libraries on the code, yes, I did it! The problem is not libraries, it's wrong algorithms. I'm using C on GCC mingw 32bits on Code::Blocks for Windows 10 Pro.
#include <float.h> #include <math.h> void bernoulli_B( int iMax, double* dB ) { dB[0] = 1.0; dB[1] = 0.5; for( int j = 3; j <= iMax; j += 2 ) dB[j] = 0.0; const double eps = DBL_EPSILON; const double TwoPi = 6.2831853071795860; double dCoeff = 2.0 / (TwoPi * TwoPi); double d2 = 2.0; for( int n = 1; n <= iMax/2; n++ ) { double g1 = 1.0, g2 = 1.0; for( int j = 0; j < n; j++ ) { g1 *= 4.0; g2 *= 9.0; } double S1 = 1.0  1.0/g1, S2 = S1 + 1.0/g2, S3; double T1 = S1 + 1.0/(g2 + g1), T2; long r = 4; double s = 1.0; int nSuccess = 0; while( !nSuccess ) { double r2 = double(r*r); double g3 = 1.0; for( int j = 0; j < n; j++ ) g3 *= r2; S3 = S2 + s/g3; T2 = S2 + s/(g3 + g2); if( fabs(T2T1) > eps*fabs(T2) ) { g2 = g3; S2 = S3; T1 = T2; s = s; r++; } else { nSuccess = 1; } } d2 /= 4.0; dB[2*n] = 2.0 * dCoeff / (1.0d2) * T2; dCoeff *= double((2*n+1)*(2*n+2)) / (TwoPi * TwoPi); } }
I've never worked with this type of stuff before, but on the series I'am working requires the Bernoulli numbers. So I don't have many sure what I'm doing to find those numbers. It's not my area. Probably I made some stupid thing here.
I'll tell you how I fall in this problem of Bernoulli, I'm originally working on Riemann Zeta's function. I made the C code but it only worked for >1, So I started to study how to calculate for Negative odd's, and I saw that Bn(Bernoulli numbers of N order) are in the formulae! I don't know how to calculate Bernoulli Numbers, and when I started to code Zeta's function I didn't know nothing about Bernoulli!

Fastest Bernoulli numbers calculation in C using (or not) GMP in CodeBlocks on Windows
Good night, I'm working in a project that needs to calculate the Bernoulli numbers for nTh order. I tried exhaustively a lot of algorithms on internet, mostly it's in C++ what's not usefull for me. And always I'd got compilations erros or the wrong results to the numbers! What is the fastest way to calculate it? Odd's numbers is always 0.00000 and I need to calculate for any even numbers... I just need the result of the number I put on the function, don't need to list the numbers until the nTh like every algorithm I saw on the internet does. The last I tried that had compilation erros and after fixed give me wrong awnsers was. Completely wrong numbers! Yes, for people that will ask me if I put the libraries on the code, yes, I did it! The problem is not libraries, it's wrong algorithms. I'm using C on GCC mingw 32bits on Code::Blocks for Windows 10 Pro.
http://www.codecogs.com/library/maths/discrete/number_theory/bernoulli_b.php
Thanks you all! Have a nice day.