|
| |||||||
| http://www.narutomania.com/forums/New Month, New Problems |
| For these forums to remain up we need $480 within 7 days. Please donate HERE br> br> We need this amount no matter what to keep this website up. Thank you for your support. |
![]() |
| | Thread Tools |
04-02-2008, 08:24 PM
| #1061 |
| Donator |
What level is this class? Would they expect you to make use of time-efficient selection algorithms? If not, the easiest thing to do is to just sort the array and then choose the element at the appropriate index. |
| |
04-02-2008, 08:28 PM
| #1062 | |
| Genin | Quote:
Create a class with: 1. One private field that is an array of doubles and let's call it myArray. 2. Constructor that takes an array of doubles as it's argument: The constructor initializes the myArray array to the passed array. 3. Public function that takes a double number as it's argument and returns a double number representing the number n that we want. pseudo-code/partial code: class Percentile{ }; Percentile:: Percentile(double nums[]){ myArray = nums;} double Percentile::getNum(double p){ } edit: didn't know that someone replied to your post and we have basically said the same thing Last edited by ahme; 04-02-2008 at 11:23 PM. | |
| |
04-02-2008, 09:40 PM
| #1063 |
| Hunter-nin |
I just wanna check my work, so can someone do this w/ the work: ∫x³/(x²+1)^(1/2) dx with the limits being 0 --> 1, as in 0 is on the bottom of ∫ representing a and 1 is on the top of ∫ representing b. This is once again, integration by parts. and also, is ∫sin(3ln x) dx = (xsin(3lnx) - 3xcos(3lnx))/10 . I dont need an explanation on how to do this problem unless I have the wrong answer.
__________________ |
| |
04-02-2008, 10:19 PM
| #1064 | |
| o({})o Join Date: Nov 2006
Posts: 98
My Mood:
Rep Power: 0 ![]() | Quote:
__________________ This is my account for use on public computers. Please do not PM this account unless you have good reason to believe that I will not be on my main account. | |
| |
04-02-2008, 10:20 PM
| #1065 |
| | Northern Cross ~ ♥ |
I have to do research on Washington for one of my classes, but I can't find anything about what kind of political issues would affect the state. Can someone help me find something or if you already know something, tell me. Thanks.
__________________ |
| |
04-02-2008, 10:58 PM
| #1066 |
| Akatsuki |
We're not concerning about time efficient as of yet. And also, I haven't really coded much with arrays and such so...
__________________ ![]() ![]() thanks to Tom, ~Mrge and Simonarturo, EE |
| |
04-02-2008, 11:32 PM
| #1067 | |
| Donator | Quote:
Yeah, then just sort the array and choose an element from it. You can do this by calling qsort. For example, say you have an array of 10 ints Code: #include <iostream>
#include <stdlib.h>
int A[] = { 8, 1, 9, 2, 7, 4, 5, 3, 0, 6 };
int compare (const void* x, const void* y)
{
return *((int*)x) - *((int*)y);
}
int main ()
{
qsort (A, 10, sizeof(int), compare);
for (int n=0; n<10; n++) {
cout << A[n] << endl;
}
return 0;
}
Code: 0 1 2 3 4 5 6 7 8 9 Last edited by MuKen; 04-02-2008 at 11:42 PM. | |
| |
05-02-2008, 03:11 AM
| #1068 | |
| Genin | Quote:
Back to the question... ∫x³/(x²+1)^(1/2) When choosing the u and dv in you want to make the problem less complicated and one way to make the problem easier is reducing the power of a polynomial. Here we have the polynomial x^3, so I can take u=x^3, but you need to stop and think for a second here because if u=x^3 then dv = (x²+1)^(1/2)dx which will require you to use trig substitution to get v and will involve very ugly looking function which will make the problem even more complicated. But, if you have sharp eyes and remember the trick of having the derivative of the numerator in the denominator (I guess I've said this too many times) then you know that taking your dv = x/(x²+1)^(1/2)dx would make this very easily integrable. So, take u=x^2 and dv=x/(x²+1)^(1/2)dx and the integral should be very easy to do. I don't have time to write down the whole solution, but the final answer is 2^(1/2)-2/3*(2^(3/2)-1) which after doing some simplification turns down to be 2/3 - (2^(1/2))/3 | |
| |
05-02-2008, 03:26 AM
| #1069 |
| Hunter-nin |
^Wait, what would v be then? Cause I tried u = x^3, and dv = 1/(x2 + 1)^.5 dx, and got du/3 = x^2 dx and v= 2(x^2 +1)^1/2 and it became 2x^3 (x^2 + 1)^1/2 - 1/3∫2x^2 (x^2 + 1) ^1/2 dx, but I dont know how to do that second integral. Is my v correct? If not, what is v if you use your dv(x/(x²+1)^(1/2) dx)? Also, I tried putting the integral in my calculator to get a numerical answer and it doesnt match your answer.
__________________ |
| |
05-02-2008, 04:00 AM
| #1070 | ||
| Genin | Quote:
Quote:
also, I've double checked my answer I think it's correct. It's (2-2^(1/2))/3 Last edited by ahme; 05-02-2008 at 05:06 AM. | ||
| |
09-02-2008, 03:46 PM
| #1071 |
| Chuunin Join Date: Jun 2007
Posts: 441
My Mood:
Rep Power: 6 ![]() |
Can anyone help me on some english? I need some comparisons between Nicholas Nickleby and Hard Times the books by Charles Dickens preferably the characters i.e Bounderby and Mr Squeers. Any help would be appreciated whether it is your own interpretations or a website link. Thanks
__________________ |
| |
09-02-2008, 04:43 PM
| #1072 |
| the Brown Join Date: Apr 2007 Location: Never separate me from these stars...
Posts: 11,138
My Mood:
Rep Power: 59 ![]() |
Here's a resources: The Life and Adventures of Nicholas Nickleby (Cri...: Information and Much More from Answers.com ^Not the best, though, if you have access to any literary databases, i'm sure you'd have better luck finding what you want. Some questions to ask your self when comparing character: Are there any similar traits between the two? Do they have simulare motives/wants? Do the two characters carry simular allusions in names, clothing, residence, and so on.
__________________ |
| |
12-02-2008, 12:23 AM
| #1073 |
| Chuunin |
Q: Suppose that f is continuous on the interval [0,1] and its strictly positive there. Show that there exists an epsilon > 0 such that f(x) > epsilon in [0,1]. (Hint: one of the hard theorems will help)
__________________ |
| |
12-02-2008, 12:47 AM
| #1074 |
| Hunter-nin |
edited
__________________ Last edited by Nivikran; 14-02-2008 at 05:17 AM. |
| |
12-02-2008, 09:08 PM
| #1075 | |
| o({})o Join Date: Nov 2006
Posts: 98
My Mood:
Rep Power: 0 ![]() | Quote:
![]() The best chance f would have is to have an asymptote y=0, but since f(x) is continuous and positive (> 0), that means y = f(x) has a positive, real value for every x on [0,1]. Any positive real number can be divided by any other positive real number to yield a positive real number (the Reals are a field under addition and multiplication). So, let f(x) = y and let epsilon = p where y, p > 0 y > y/2 for all y Therefore, taking the local min of f(x) in [0,1] will offer us a y[sub]min[sub] for which all other y >= ymin. That in mind, y >= ymin > ymin/2 Let p = ymin/2, and y > p for all y. Still, that's just a long way of saying something I think is fairly trivial.
__________________ This is my account for use on public computers. Please do not PM this account unless you have good reason to believe that I will not be on my main account. Last edited by ]MpC[hebe; 14-02-2008 at 04:42 AM. | |
| |
14-02-2008, 01:24 AM
| #1076 |
| Akatsuki |
This function should take two arguments, an array or vector of numbers A and a percentile p. It should return the number n in A such that p percent of all items in A are smaller than n. ---- From the code you guys gave me, I don't see any vectors. So would the function be something like this? vector<string> vect; someFunction(vect, p) { return n }
__________________ ![]() ![]() thanks to Tom, ~Mrge and Simonarturo, EE |
| |
14-02-2008, 04:29 AM
| #1077 |
| Donator |
They said you could use an array or a vector right? The code I showed above uses an array... If you are required to use a vector, I'd just go ahead and fill an array from the vector anyway so you can make use of the qsort function; it saves a lot of work. |
| |
15-02-2008, 12:37 AM
| #1078 |
| Akatsuki |
I do have a choice for array or vector, I want to choose vector. So the post above, did I have the outline right? If I wrote a function that had two arguments, one vector, and the other P?
__________________ ![]() ![]() thanks to Tom, ~Mrge and Simonarturo, EE |
| |
15-02-2008, 01:05 AM
| #1079 |
| Donator |
Yeah, that structure is right, though the syntax should be something like someFunction(vector<int>& vect, double p) { return n; } Last edited by MuKen; 15-02-2008 at 01:06 AM. |
| |
15-02-2008, 04:32 AM
| #1080 |
| Akatsuki |
^ do i still have to put Vector<int>&, doublep) if it's a class, and I have a vector as a private data member?
__________________ ![]() ![]() thanks to Tom, ~Mrge and Simonarturo, EE |
| |