scientific-computing

Plotting log-binned network degree distributions

拈花ヽ惹草 提交于 2019-12-20 11:00:01
问题 I have often encountered and made long-tailed degree distributions/histograms from complex networks like the figures below. They make the heavy end of these tails, well, very heavy and crowded from many observations: However, many publications I read have much cleaner degree distributions that don't have this clumpiness at the end of the distribution and the observations are more evenly-spaced. ! How do you make a chart like this using NetworkX and matplotlib ? 回答1: Use log binning (see also)

Python module for multiple variable global optimization

雨燕双飞 提交于 2019-12-20 10:33:39
问题 I have been looking for a python module that implements the common techniques of global optimization (finding the global minimum of a function in N dimensions) without success. If you heard about a simulated annealing or genetic algorithm implementation in python, please share. 回答1: Scipy's optimize module has an anneal function that might fit your needs. Also, you should check out the PyEvolve module for doing a genetic algorithm. 回答2: I'm not an expert, but have you looked at: Scipy's

Help with symplectic integrators

流过昼夜 提交于 2019-12-20 09:59:43
问题 I'm trying to develop a physics simulation and I want to implement a fourth-order symplectic integration method. The problem is that I must be getting the math wrong, since my simulation is not working at all when using the symplectic integrator (as compared to a fourth-order Runge-Kutta integrator that works reasonably well for the simulation). I've been googling this forever and all I can find are scientific articles on the subject. I tried to adapt the method used in the articles, but am

Javascript and Scientific Processing? [closed]

断了今生、忘了曾经 提交于 2019-12-20 08:41:08
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Matlab, R, and Python are powerful but either costly or slow for some data mining work I'd like to do. I'm considering using Javascript both for speed, good visualization libraries, and to be able to use the browser as an interface. The first question I faced is the obvious

Which IDE for scientific computing and plotting in Python? [closed]

纵饮孤独 提交于 2019-12-20 08:39:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am currently using R for all my scientific computing and plotting, but I would like to explore Python. I have been using RStudio as an IDE for R, which as an IDE fulfills 100% of my need for scientific computing, number crunching, data analysis and visualizations. Is there something similar for Python?

Which IDE for scientific computing and plotting in Python? [closed]

此生再无相见时 提交于 2019-12-20 08:38:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am currently using R for all my scientific computing and plotting, but I would like to explore Python. I have been using RStudio as an IDE for R, which as an IDE fulfills 100% of my need for scientific computing, number crunching, data analysis and visualizations. Is there something similar for Python?

What can MATLAB do that R cannot do? [closed]

自作多情 提交于 2019-12-20 07:57:24
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not

How to make up lost reference to declare a field (numpy)?

我们两清 提交于 2019-12-20 06:35:30
问题 Let's say I have class that contains a lot of fields and I want to make initializer that work for all fields so that I don't need to write an initializer for each of them. class Foo(): def __init__(n): self.n = n self.x = None self.m = None self.v = None but method def init_x(self, x): # initialize or erase x to zeros x = np.zeros(self.n) doesn't work because x= loses reference to x . But @staticmethod def get_x(x, i): return x[i] @staticmethod def set_x(x, i): x[i] = val works. What could

Efficient algorithm for evaluating a 1-d array of functions on a same-length 1d numpy array

跟風遠走 提交于 2019-12-19 21:57:09
问题 I have a (large) length-N array of k distinct functions, and a length-N array of abcissa. I want to evaluate the functions at the abcissa to return a length-N array of ordinates, and critically, I need to do it very fast. I have tried the following loop over a call to np.where, which is too slow: Create some fake data to illustrate the problem: def trivial_functional(i): return lambda x : i*x k = 250 func_table = [trivial_functional(j) for j in range(k)] func_table = np.array(func_table) #

Open source alternative to MATLAB's fmincon function?

孤人 提交于 2019-12-18 10:06:16
问题 Is there an open-source alternative to MATLAB's fmincon function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / NumPy / SciPy and this is the only function I haven't found an equivalent to. A NumPy-based solution would be ideal, but any language will do. 回答1: Is your problem convex? Linear? Non-linear? I agree that SciPy.optimize will probably do the job, but fmincon is a sort of bazooka for solving optimization problems, and you'll be better off if you