Back Home Up

Subchapters:

Exercices scalars

 

  1. Define X and Y to be two different integers

  2. Print their sum and difference to the terminal screen

  3. Repeat, all on one IDL command line, using the "&" character

  4. Repeat all of the above, using the recall buffer ("up" arrow)

  5. Print the result of adding 3 times X to 2 times Y 

  6. Print the product of (X-Y) and (X+Y)

  7. Print the common logarithm of the absolute value of X+Y (use the ABS and ALOG10 functions)

  8. Confirm this result by raising 10.0 to the power you just obtained

  9. What is the difference between X = 5/2 and Y = 5./2 ?

  10. Between  X = FLOAT(5/2) and Y = FLOAT(5)/2 ?

  11. Set C equal to the numerical value of the speed of light in cgs units

  12. Successively print powers of C until you locate the point at which the result becomes "Inf".  

  13. What power yields this result?  [The answer is non-integer.]

  14. Now define C to be the speed of light in double precision.

  15. Repeat the exercise above [Hint: you should accelerate all such exercises by making liberal use of the recall buffer and line editing.]

  16. String example:  define a string variable for each word in the sentence: "This is a concatenation"; then concatenate them and print the result.

 

From http://www.astro.virginia.edu/class/oconnell/astr511/IDLexercises/

 

IDL courses C. Morisset © 2004 IA/UNAM V 2.2

Back Home Up