The problem is that because the numbers from somenumber[] are different lengths, the numbers from someinteger[] dont come out aligned nicely under eachother :( how do i fix this? Is there a command...
Hi, thanks for the reply! Sorry i wasnt more specific before, allow me to elaborate:
I take two random numbers between 0 and 1, by doing
( rand()%10000 ) / 10000, call these numbers a and b. Then the (nearly) normal distributed number N is generated as follows: N= (-2*ln(a))^0.5 * cos(2pi*b) ..Assume i do this 100 times, i have 100 "normal distributed" numbers. (standard deviation, median 0 [0,1]
counting the number of observations in given intervals, C++
Hi guys :)
I'm writing this program that enabls the user to choose a number of observations, from the normal distribution. I.e. Lets say the user chooses 100 observations, then the program will generate 100 random numbers from the normal distribution. My problem is that i have 10 known intervals, and i have to enable the program to count how many of the 100 observations fall in each interval. I dont know how to do this, i havent learnt...
sorry about that cats! I wasnt aware *blush* i sort of expected the "press any key to continue part" to also be there when i launched the .exe and that was essentially the mistake.. in fact my program didnt -crash- , it actually just was finished.. thats why adding the do/while around it solved the problem .. so sorry for not posting that info before, that was just due to my lack of basic knowledge of Visual :p apologies for that hehe....
hey 2wycked, thx for ur reply :) u just got it in while i was typing mine above, thx for pointing out that in fact u differentiate it by removing the integral, i had sort of overlooked that :p but i think i will just go for the secant method now, since it wont really change alot for me.. the thing is i just have to recode a fuction that can calculate the value of phi for me.. i have done this previously, but unfortunately i have lost the code somewhere.....
Well i realize i can use the secant method, but dont i also have to calculate phi(x)? I mean, what should i set f(x) to be in this case?
Suppose start out choosing x0 and x1 to start the secant method, i would the have to calculate f(x) to be phi(x)-0.1 .. how do i calculate phi(x)? I could either use simpsons rule or create a taylor polynomial ...am i correct? So it would look something...
Ok i have this problem, i need to solve the equation phi(x) = 0.1
(where phi is the area under the gaussian normal distribution function)
apparently im supposed to solve it as f(x)=0 , ( phi(x) - 0.1 =0 ) , which can be solved by iteration, for example by using newton-raphson. But i have no idea how to do this. NR needs f(x), f'(x), how can i get that from phi? :s since that function cant...
WOOP! Sorry for the double post, but i JUST wanted to say that i was indeed right ! :) i just added the do/while around all the code in main() which then requires a y/n answer, this keeps the program from terminatin after the code has been run :) so yeah..
This thread can be closed now, got my answer :) Thx to all who posted! What a beginners error :/ *blush* hehe :p
But hmm! I did as you said, created a new console application, added the .cpp file from the old folder, built and executed from within VC, which worked. But when i closed down VC and launched the .exe from the new folder, the same problem, crashes at the same place! :S Now i was wondering, could it be that the program just terminates after its run all the code? I mean, usually when it has finished running,...
"I'm guessing you coded a relative path, and then are executing from a different location, but that's just a wild guess with the information provided..."
-sorry, im not even sure i know what that means :o when i first started making the program i did the usual "win32 console application + C++ source file thing" and then chose the desktop as the destination to save...
Program crashes when not loaded from inside Visual C++ 6.0
Hi guys, my first post here, im desperately in need of help! :)
When i am running Visual C++ 6.0 and have my .cpp file opened, i compile, build and run the program, it all works fine. But if i close Visual and try to run the program .exe from the Debug folder, it crashes half way through the program :( i dont understand why ..i will refrain from posting the code for my program since its quite long and messy.. hope anyone knows a s...
Leave a comment: