GCalc.MathEquationManager – GCalc-2 Reference Manual

# MathEquationManager

## Object Hierarchy:

## Description:

public interface MathEquationManager : Object

Equation manager, holding a set of equations and variables.

Equations can depend on calculated expression from variables or values set to variables when they are a MathParameter

In the next code you create a parser, then use Parser.parse to add the parsed equation to an equation manager.

     var parser = new Parser ();
     var eqman = new EquationManager ();
     parser.parse ("3*5", eqman);
     var eq = eqman.equations.get_item (0) as MathEquation;
     var res = eq.solve ();
     var c = (MathConstant) res;
     // Result will be 15
     stdout.printf ("%g", c.real ());

Is possible to create expressions, set to a variable, add to an equation manager create an expression using that variable to add to the manager; then solve the dependant equation and then the variable will be evalated too, in order to produce a result:

     var parser = new Parser ();
     var eqman = new EquationManager ();
     parser.parse ("x=3*5", eqman);
     parser.parse ("2*x+7*x^2", eqman);
     var eq = eqman.equations.get_item (1) as MathEquation;
     var res = eq.solve ();
     var c = (MathConstant) res;
     // Result will be 1605
     stdout.printf ("%g", c.real ());

Is possible to define parameters instead of MathVariable. To do so, fine them at parsing time, then you can get it to change its value, to evaluate the dependant equation.

     var parser = new Parser ();
     var eqman = new EquationManager ();
     parser.parse ("$param1*5", eqman);
     var eq = eqman.equations.get_item (1) as MathEquation;
     var p = eqman.variable.find_named ("param1");
     p.set_value (5.0);
     var res = eq.solve ();
     var c = (MathConstant) res;
     // Result will be 25
     stdout.printf ("%g", c.real ());

All known implementing classes:

- EquationManager

Namespace: GCalc
Package: GCalc-2

## Content:

### Properties:

- public abstract ExpressionContainer equations { get; }
  Set of equations. They can be related or not.
- public abstract ExpressionContainer functions { get; }
  Set of functions defined to be possibily used in equations.

### Methods:

- public virtual MathVariable find_variable (string name)
  Set of variables or parameters defined in the set of equations.

### Inherited Members:

All known members inherited from class GLib.Object

- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data

- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer

- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref