Search Results

Search found 41 results on 2 pages for 'arkapravo'.

Page 2/2 | < Previous Page | 1 2 

  • Issues in Ada Concurrency

    - by Arkapravo
    Hi I need some help and also some insight. This is a program in Ada-2005 which has 3 tasks. The output is 'z'. If the 3 tasks do not happen in the order of their placement in the program then output can vary from z = 2, z = 1 to z = 0 ( That is easy to see in the program, mutual exclusion is attempted to make sure output is z = 2). WITH Ada.Text_IO; USE Ada.Text_IO; WITH Ada.Integer_Text_IO; USE Ada.Integer_Text_IO; WITH System; USE System; procedure xyz is x : Integer := 0; y : Integer := 0; z : Integer := 0; task task1 is pragma Priority(System.Default_Priority + 3); end task1; task task2 is pragma Priority(System.Default_Priority + 2); end task2; task task3 is pragma Priority(System.Default_Priority + 1); end task3; task body task1 is begin x := x + 1; end task1; task body task2 is begin y := x + y; end task2; task body task3 is begin z := x + y + z; end task3; begin Put(" z = "); Put(z); end xyz; I first tried this program (a) without pragmas, the result : In 100 tries, occurence of 2: 86, occurence of 1: 10, occurence of 0: 4. Then (b) with pragmas, the result : In 100 tries, occurence of 2: 84, occurence of 1 : 14, occurence of 0: 2. Which is unexpected as the 2 results are nearly identical. Which means pragmas or no pragmas the output has same behavior. Those who are Ada concurrency Gurus please shed some light on this topic. Alternative solutions with semaphores (if possible) is also invited. Further in my opinion for a critical process (that is what we do with Ada), with pragmas the result should be z = 2, 100% at all times, hence or otherwise this program should be termed as 85% critical !!!! (That should not be so with Ada)

    Read the article

  • Throw of a dice in Java

    - by Arkapravo
    The throw of a dice is a popular program in Java, public class Dice { /* This program simulates rolling a dice */ public static void main(String[] args) { int dice; // The number on the dice. dice = (int) (Math.random() * 6 + 1); System.out.println (dice); } } What I wish to do is make it repeat, 500 times. I have not been able to put this program into a loop of 500. I usually program in Python, thus I guess my Java has rusted ! Any help is most welcome !

    Read the article

  • Microsoft Robotics Studio in Ubuntu, with Wine ?

    - by Arkapravo
    I am using Ubuntu 9.10 and I am a bit of a robotics enthusiast. I have used KiKS (in MATLAB for simulating Khepera robots), MobotSim (in Windows, simulates a point like robot using a BASIC editor) and Player/Stage (with C/C++ on Ubuntu 9.04). My question, can MS Robotics Studio be installed in Ubuntu Linux using Wine (I am using 1.1.31) ? Has anyone done it ? Any other way to install MS Robotics Studio in Unix (Any flavour) ? Thanks for your reply !

    Read the article

  • MATLAB Heart Curve

    - by Arkapravo
    I am trying to get this in MATLAB, however I am not successful ! Any MATLAB gurus out there ? I guess simple commands should work, a program may not be needed. The error, I am getting is; >> t = -pi:0.1:pi; >> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ; ??? Error using ==> mtimes Inner matrix dimensions must agree.

    Read the article

  • Matplotlib: plotting discrete values

    - by Arkapravo
    I am trying to plot the following ! from numpy import * from pylab import * import random for x in range(1,500): y = random.randint(1,25000) print(x,y) plot(x,y) show() However, I keep getting a blank graph (?). Just to make sure that the program logic is correct I added the code print(x,y), just the confirm that (x,y) pairs are being generated. (x,y) pairs are being generated, but there is no plot, I keep getting a blank graph. Any help ?

    Read the article

  • Histogram in Matplotlib with input file

    - by Arkapravo
    I wish to make a Histogram in Matplotlib from an input file containing the raw data (.txt). I am facing issues in referring to the input file. I guess it should be a rather small program. Any Matplotlib gurus, any help ? I am not asking for the code, some inputs should put me on the right way !

    Read the article

  • Can an algorithmic process ever give true random numbers ?

    - by Arkapravo
    I have worked with random functions in python,ruby, MATLAB, Bash and Java. Nearly every programming language has a function to generate Random numbers. However, these apparently random sequences are termed as pseudo-random number sequences as the generation follows a deterministic approach, and the sequence seems to repeat (usually with a very large period). My question, can an algorithmic/programming process ever yield true random numbers ? The questions probably is more of theoretical computer science than just programming !

    Read the article

  • MATLAB : frequency distribution

    - by Arkapravo
    I have raw observations of 500 numeric values (ranging from 1 to 25000) in a text file, I wish to make a frequency distribution in MATLAB. I did try the histogram (hist), however I would prefer a frequency distribution curve than blocks and bars. Any help is appreciated !

    Read the article

  • Funny plots in MATLAB

    - by Arkapravo
    I recently learned the ezplot function in MATLAB. Recently I typed in ezplot('x^y - y^x', [-100 100 -100 100]); and this is what I got; Can anyone please tell me whatever is happening ? for lower scaling of x and y ( [ -10 10 -10 10]) there are more patterns in the 2nd 3rd and 4th quadrants. I was not very sure of the shape of curve, but I did not expect this !

    Read the article

  • MATLAB : search and count (?)

    - by Arkapravo
    Some MATLAB help needed ! I have an set of 1s and 0s, I need to find how many 1s and how many 0s. (i.e. x = [ 1 1 0 0 0 0 0 1 0 0 1 1 ....] ) . I was looking at some search and count inbuilt function, however I have not been successful.

    Read the article

< Previous Page | 1 2