integrate

Definite Integral Matlab

做~自己de王妃 提交于 2019-12-11 01:16:14
问题 I'm working on a project in Matlab and need to find the area between two lines (intersecting in a point (xIntersection,yIntersection) in the interval [-1,+1]. So the idea is to subtract the two lines and integrate between [-1, xIntersection] and [xIntersection, +1], sum the results and if it's negative, change its sign. For details on how I find the intersection of the two lines check this link. I'm using Matlab's function int(), here a snippet of my code: xIntersection = ((x_1 * y_2 - y_1 *

Integrate a function with each element of numpy arrays as limit of integration

﹥>﹥吖頭↗ 提交于 2019-12-10 22:22:14
问题 I have a function in python (using scipy and numpy also) defined as import numpy as np from scipy import integrate LCDMf = lambda x: 1.0/np.sqrt(0.3*(1+x)**3+0.7) I would like to integrate it from 0 to each element in a numpy array say z = np.arange(0,100) I know I can write a loop for each element iterating through like an=integrate.quad(LCDMf,0,z[i]) But, I was wondering if there is a faster, efficient (and simpler) way to do this with each numpy element. 回答1: You could rephrase the problem

Quickbooks PHP DevKit

做~自己de王妃 提交于 2019-12-10 10:30:25
问题 I am currently in the process of integrating my php website with the desktop version of Quickbooks. The application resides on a remote computer and will need to remain in sync with the mysql db on my server. After a great deal of research it appears my two options are: Use the PHP Devkit and the web connector to accomplish this. Manually export csv files periodically from quickbooks and parse them and insert the data into my mysql db. In regards to the first option, I can't seem to find any

Python: integrating area under curve with uneven steps in x

≡放荡痞女 提交于 2019-12-10 07:28:30
问题 I have a list of y values and a list of x values. I would like to find the area under the curve defined by these points. I have found a couple of solutions to this problem for x values with even spacing: 1) Calculating the area under a curve given a set of coordinates, without knowing the function 2) Using scipy to perform discrete integration of the sample But neither of these works when the x values are not evenly spaced. For example: >>> from scipy.integrate import simps >>> y = np.array(

How to use tplquad?

淺唱寂寞╮ 提交于 2019-12-08 10:53:58
问题 I try to integrate this : integrate(integrate(integrate(2*sin(z)*cos(atan((2*cos(y)-0.5+x)/(2*sin(y)))),y,0,pi/2),x,0,1),z,0,pi/2); Wolfram find the solution but I would like to control the accuracy. I try with tplquad but there is some error. def f(x,y,z): return 2*sin(z)*cos(atan((2*cos(y)-0.5+x)/(2*sin(y)))) tplquad(f,0,1,0,pi/2,0,pi/2) The errors are: Blockquote File "", line 3, in File "/usr/lib/python2.7/dist-packages/scipy/integrate/quadpack.py", line 526, in tplquad return dblquad(

Integration not successful in Python QuTiP

∥☆過路亽.° 提交于 2019-12-07 07:56:31
I have been trying to use QuTiP to solve a quantum mechanics matrix differential equation (a Lindblad equation). Here is the code: from qutip import * from matplotlib import * import numpy as np hamiltonian = np.array([[215, -104.1, 5.1, -4.3 ,4.7,-15.1 ,-7.8 ], [-104.1, 220.0, 32.6 ,7.1, 5.4, 8.3, 0.8], [ 5.1, 32.6, 0.0, -46.8, 1.0 , -8.1, 5.1], [-4.3, 7.1, -46.8, 125.0, -70.7, -14.7, -61.5], [ 4.7, 5.4, 1.0, -70.7, 450.0, 89.7, -2.5], [-15.1, 8.3, -8.1, -14.7, 89.7, 330.0, 32.7], [-7.8, 0.8, 5.1, -61.5, -2.5, 32.7, 280.0]]) H=Qobj(hamiltonian) ground=Qobj(np.array([[ 0.0863685 ], [ 0

Update initial condition in ODE solver each time step

你。 提交于 2019-12-06 11:48:30
问题 I am wanting to solve a system of ODEs where for the first 30,000 seconds, I want one of my state variables to start from the same initial value. After those 30,000 seconds, I want to change the initial value of that state variable to something different and simulate the system for the rest of time. Here is my code: def ode_rhs(y, t): ydot[0] = -p[7]*y[0]*y[1] + p[8]*y[8] + p[9]*y[8] ydot[1] = -p[7]*y[0]*y[1] + p[8]*y[8] ydot[2] = -p[10]*y[2]*y[3] + p[11]*y[9] + p[12]*y[9] ydot[3] = -p[13]*y

Quickbooks PHP DevKit

老子叫甜甜 提交于 2019-12-06 09:17:00
I am currently in the process of integrating my php website with the desktop version of Quickbooks. The application resides on a remote computer and will need to remain in sync with the mysql db on my server. After a great deal of research it appears my two options are: Use the PHP Devkit and the web connector to accomplish this. Manually export csv files periodically from quickbooks and parse them and insert the data into my mysql db. In regards to the first option, I can't seem to find any resources indicating that it's possible to query all items from the quickbooks db. This would be ideal

Update initial condition in ODE solver each time step

北城以北 提交于 2019-12-04 17:07:43
I am wanting to solve a system of ODEs where for the first 30,000 seconds, I want one of my state variables to start from the same initial value. After those 30,000 seconds, I want to change the initial value of that state variable to something different and simulate the system for the rest of time. Here is my code: def ode_rhs(y, t): ydot[0] = -p[7]*y[0]*y[1] + p[8]*y[8] + p[9]*y[8] ydot[1] = -p[7]*y[0]*y[1] + p[8]*y[8] ydot[2] = -p[10]*y[2]*y[3] + p[11]*y[9] + p[12]*y[9] ydot[3] = -p[13]*y[3]*y[6] + p[14]*y[10] + p[15]*y[10] - p[10]*y[2]*y[3] + p[11]*y[9] + p[9]*y[8] - p[21]*y[3] ydot[4] =

Solr/Lucene分布式搜索,Solr Integrate katta step3

自闭症网瘾萝莉.ら 提交于 2019-12-04 16:26:46
前面的两篇介绍了安装katta及ZooKeeper,后边来介绍katta的Node. 我们回到step1 后边提到的solr-katta-plugin项目,源码导入后会出现很多的错误,在项目中继承了solr-core,和solrj中的类尝试着把访问修饰private改为protected. 如:solr-core org.apache.solr.handler.component.SearchHandler类中的shardHandlerFactory成员变量 protected ShardHandlerFactory shardHandlerFactory = new HttpShardHandlerFactory(); 同时借鉴 https://issues.apache.org/jira/browse/SOLR-1395 Tomliu的做法,把 the bugs is : 1. solr's ShardDoc.java, ShardFieldSortedHitQueue line 210 : final float f1 = e1.score == null ? 0.00f : e1.score; final float f2 = e2.score == null ? 0.00f : e2.score; 等等.直到项目基本错误解决. 下载solr并且copy其中的apache