Next: Functions and Variables for stats, Previous: Introduction to stats, Up: stats-pkg [Contents][Index]

### 89.2 Functions and Variables for inference_result

Function: inference_result (title, values, numbers)

  Constructs an `inference_result` object of the type returned by the stats functions. Argument title is a string with the name of the procedure; values is a list with elements of the form `symbol = value` and numbers is a list with positive integer numbers ranging from one to `length(values)`, indicating which values will be shown by default.

  Example:

  This is a simple example showing results concerning a rectangle. The title of this object is the string `"Rectangle"`, it stores five results, named `'base`, `'height`, `'diagonal`, `'area`, and `'perimeter`, but only the first, second, fifth, and fourth will be displayed. The `'diagonal` is stored in this object, but it is not displayed; to access its value, make use of function `take_inference`.

      (%i1) load("inference_result")$
      (%i2) b: 3$ h: 2$
      (%i3) inference_result("Rectangle",
                              ['base=b,
                               'height=h,
                               'diagonal=sqrt(b^2+h^2),
                               'area=b*h,
                               'perimeter=2*(b+h)],
                              [1,2,5,4] );
                              |   Rectangle
                              |
                              |    base = 3
                              |
      (%o3)                   |   height = 2
                              |
                              | perimeter = 10
                              |
                              |    area = 6
      (%i4) take_inference('diagonal,%);
      (%o4)                        sqrt(13)

  See also `take_inference`.

  Categories:Package stats ·

Function: inferencep (obj)

  Returns `true` or `false`, depending on whether obj is an `inference_result` object or not.

  Categories:Package stats ·

Function: items_inference (obj)

  Returns a list with the names of the items stored in obj, which must be an `inference_result` object.

  Example:

  The `inference_result` object stores two values, named `'pi` and `'e`, but only the second is displayed. The `items_inference` function returns the names of all items, no matter they are displayed or not.

      (%i1) load("inference_result")$
      (%i2) inference_result("Hi", ['pi=%pi,'e=%e],[2]);
                                  |   Hi
      (%o2)                       |
                                  | e = %e
      (%i3) items_inference(%);
      (%o3)                        [pi, e]

  Categories:Package stats ·

Function: take_inference
`take_inference` (n, obj)
`take_inference` (name, obj)
`take_inference` (list, obj)

  Returns the n-th value stored in obj if n is a positive integer, or the item named name if this is the name of an item. If the first argument is a list of numbers and/or symbols, function `take_inference` returns a list with the corresponding results.

  Example:

  Given an `inference_result` object, function `take_inference` is called in order to extract some information stored in it.

      (%i1) load("inference_result")$
      (%i2) b: 3$ h: 2$
      (%i3) sol: inference_result("Rectangle",
                                  ['base=b,
                                   'height=h,
                                   'diagonal=sqrt(b^2+h^2),
                                   'area=b*h,
                                   'perimeter=2*(b+h)],
                                  [1,2,5,4] );
                              |   Rectangle
                              |
                              |    base = 3
                              |
      (%o3)                   |   height = 2
                              |
                              | perimeter = 10
                              |
                              |    area = 6
      (%i4) take_inference('base,sol);
      (%o4)                           3
      (%i5) take_inference(5,sol);
      (%o5)                          10
      (%i6) take_inference([1,'diagonal],sol);
      (%o6)                     [3, sqrt(13)]
      (%i7) take_inference(items_inference(sol),sol);
      (%o7)                [3, 2, sqrt(13), 6, 10]

  See also `inference_result`, and `take_inference`.

  Categories:Package stats ·

Next: Functions and Variables for stats, Previous: Introduction to stats, Up: stats-pkg [Contents][Index]