Jump to content

Template:ROOT/Template Documentation/Exercise

From Wikibooks, open books for an open world
This is the documentation for the template Exercise designed for the book ROOT. Please embed this documentation on the template's page (or elsewhere) with {{ROOT/Template Documentation/Exercise}}. To edit the template documentation, please edit this page.

This is a template designed for the book ROOT. It should be used to embed exercises into other pages.

Syntax

[edit source]
{{ROOT/Exercise|#1}}
Parameter Default Value Mandatory Description
#1 various yes Name of the exercise to embed.

Further Explanation

[edit source]
  • If necessary: Create a new page for the exercise and name it Template:ROOT/Exercises/A new ROOT Exercise. Put <onlyinclude></onlyinclude> tags around the question.
  • Go to the page you want to embed the exercise and add {{ROOT/Exercise|A new ROOT Exercise}}. Note that the Template:ROOT/Exercises/ in the exercise's name is omitted!
  • Also embed the exercise on the page ROOT/Exercises.

Example

[edit source]

In this example, we embed the exercise Trying Interactive ROOT which is located at the page named Template:ROOT/Exercises/Trying Interactive ROOT.

{{ROOT/Exercise|Trying Interactive ROOT}}

Result

[edit source]
Exercise: Trying Interactive ROOT
On an interactive ROOT session: Fill an array of 100 000 000 64Bit floating point numbers of the machine independent ROOT type Double_t with random numbers. Compute the mean of the array and print it to the console. Note the computation time.

Hint: You can get random real numbers by creating a pointer to an instance of the TRandom class. (The constructor takes one arbitrary integer as initialization.) Then you can call the method TRandom::Rndm() to get a simple pseudo random number uniformly distributed between 0 and 1. For example:

TRandom *R = new TRandom(time(0));  // create a pointer to a new instance of TRandom in the heap
cout << R->Rndm() << endl;
[Solution]