473,659 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to integrate an array?

I need to compute integral of some array function, something
like:

from scipy import *
f = lambda x: array( [sin(x),cos(x)] )
integrate.quad( f, 0, 1)
Unfortunately integrate.quad requires Float type.

Any ideas how to perform this?

Thanks,
T.Kaz.
Sep 4 '05 #1
3 9471
Tom Kaz wrote:
I need to compute integral of some array function, something
like:

from scipy import *
f = lambda x: array( [sin(x),cos(x)] )
integrate.quad( f, 0, 1)

Unfortunately integrate.quad requires Float type.

Any ideas how to perform this?


Do each function separately. The routine that scipy.integrate .quad uses
adapts to the local conditions of the function (when the function is
flat, it uses fewer samples; when steep, more).

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Sep 4 '05 #2
Do each function separately. The routine that scipy.integrate .quad uses
adapts to the local conditions of the function (when the function is
flat, it uses fewer samples; when steep, more).


It's not so easy to do it separately. I want to integrate function that
includes linalg.expm - as you see calculation the function is quite
expensive.

T.Kaz.
Sep 4 '05 #3
Tom Kaz wrote:

[I wrote:] (please attribute quotes)
Do each function separately. The routine that scipy.integrate .quad uses
adapts to the local conditions of the function (when the function is
flat, it uses fewer samples; when steep, more).


It's not so easy to do it separately. I want to integrate function that
includes linalg.expm - as you see calculation the function is quite
expensive.


I understand, but the good integration algorithms really do need to
evaluate each dimension separately.

If you can bear algorithms that only use samples from fixed intervals,
then you can use the functions romb(), simps(), or trapz() in
scipy.integrate .

BTW, a better place to ask scipy questions would be the scipy mailing list.

http://scipy.net/mailman/listinfo/scipy-user

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Sep 4 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
2649
by: Swartz | last post by:
Hi all. I'm working here on a small project of mine. I'm not new to programming, but I'm new to PHP. You have to understand that I'm coming from C++, OOP world, so my code might seems a little too "object"-ified. Anyways, I've created a wrapper class for MySQL connectivity. It's barebones for now, no error checking or anything. So now I'm trying to create user/session-handling class that would work with the data stored in the database...
0
1830
by: glin | last post by:
Hi I am trying to integrate the xmlrpc server into a class, does anyone know how to get it working? test.html: <html> <head> <title>XMLRPC Test</title> <script src="jsolait/init.js"></script> <script src="jsolait/lib/urllib.js"></script> <script src="jsolait/lib/xml.js"></script>
0
1352
by: Rob R. Ainscough | last post by:
I'm looking for some Knowledge base tools that would integrate into VS.2003 and be flexible. My developers would us it to house important tips, tricks, and other information -- needs to have ability for me to control categories and sub categories and key words, etc. etc. I've seen a few Internet based tools but those are way too worky and slow for our needs -- anyone produce a tool that will integrate with VS.2003 or is a good stand...
5
2644
by: Marcelo | last post by:
How can I integrate c++ programs inside a GUI java interface? I would like to get the results from a c++ program and integrate them inside a java GUI. thanks Marcelo
1
4122
by: Johnny Meredith | last post by:
Dear All, I have an Access database that tracks the progress of income tax audits. When the taxing authorities make a change (an "Adjustment"), I record the pertinent information in the database. At the end of the audit cycle, these adjustments are used to compute the revised taxes due. This computation is done in a fairly complex, but accurate and easy to use, spreadsheet. In the spreadsheet, there is a sheet that lists out all...
0
1138
by: P McGinness | last post by:
Basically, I've a JS function called ValidateForm(), which returns true or false and controls if the form submits. When I integrate this with .NET validators, the .NET always adds it's own call to a function to the end of the form onSubmit script. So if my function returns false, .NETs function is still called and when it returns true will basically render my code pointless. I'm not entirely sure of the best way to integrate custom
2
2214
by: pdmountaineer | last post by:
hi, I am writing a C program and I would like to integrate some executables (.EXE files) from my C program. Is this possible and how should one do this exactly? kind regards
6
1856
by: neha_chhatre | last post by:
hello i have a problem... have written two separate c files named read.c and twinkle.c the file read.c, after running stores some values in an array name average and it has a count variable k...... now i need to read both average and the variable k from the twinkle.c file
6
4746
by: najmi | last post by:
hai.. i have used jquery fullcalendar for my application and i have one problem that is how to display the event from the database.i have found the sample given in php but i want it in jsp.can anyone help me to translate this short code to jsp or java.here is the code <?php $year = date('Y'); $month = date('m'); echo json_encode(array(
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.