AgsMathUtil

AgsMathUtil — math util

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Includes

#include <ags/lib/ags_math_util.h>

Description

Common math utility functions.

Functions

ags_math_util_find_parenthesis_all ()

void
ags_math_util_find_parenthesis_all (gchar *str,
                                    gint **open_position,
                                    gint **close_position,
                                    guint *open_position_count,
                                    guint *close_position_count);

Find all parenthesis.

Parameters

str

the string

 

open_position

open position array return location.

[out]

close_position

close position array return location.

[out]

open_position_count

open position count return location.

[out]

close_position_count

close position count return location.

[out]

Since: 3.2.0


ags_math_util_find_exponent_parenthesis ()

void
ags_math_util_find_exponent_parenthesis
                               (gchar *str,
                                gint **exponent_open_position,
                                gint **exponent_close_position,
                                guint *exponent_open_position_count,
                                guint *exponent_close_position_count);

Find exponent parenthesis.

Parameters

str

the string

 

exponent_open_position

exponent open position array return location.

[out]

exponent_close_position

exponent close position array return location.

[out]

exponent_open_position_count

exponent open position count return location.

[out]

exponent_close_position_count

exponent close position count return location.

[out]

Since: 3.2.0


ags_math_util_find_function_parenthesis ()

void
ags_math_util_find_function_parenthesis
                               (gchar *str,
                                gint **function_open_position,
                                gint **function_close_position,
                                guint *function_open_position_count,
                                guint *function_close_position_count);

Find function parenthesis.

Parameters

str

the string

 

function_open_position

function open position array return location.

[out]

function_close_position

function close position array return location.

[out]

function_open_position_count

function open position count return location.

[out]

function_close_position_count

function close position count return location.

[out]

Since: 3.2.0


ags_math_util_find_term_parenthesis ()

void
ags_math_util_find_term_parenthesis (gchar *str,
                                     gint **term_open_position,
                                     gint **term_close_position,
                                     guint *term_open_position_count,
                                     guint *term_close_position_count);

Find term parenthesis.

Parameters

str

the string

 

term_open_position

term open position array return location.

[out]

term_close_position

term close position array return location.

[out]

term_open_position_count

term open position count return location.

[out]

term_close_position_count

term close position count return location.

[out]

Since: 3.2.0


ags_math_util_match_sign ()

gboolean
ags_math_util_match_sign (gchar *offset,
                          gchar *end_ptr,
                          gchar **start_offset,
                          gchar **end_offset);

Match sign.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_match_coefficient ()

gboolean
ags_math_util_match_coefficient (gchar *offset,
                                 gchar *end_ptr,
                                 gchar **start_offset,
                                 gchar **end_offset);

Match coefficient including optional sign.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_match_symbol ()

gboolean
ags_math_util_match_symbol (gchar *offset,
                            gchar *end_ptr,
                            gchar **start_offset,
                            gchar **end_offset);

Match symbol including optional sign.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_match_exponent ()

gboolean
ags_math_util_match_exponent (gchar *offset,
                              gchar *end_ptr,
                              gchar **start_offset,
                              gchar **end_offset);

Match exponent with or without parenthesis.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_match_operator ()

gboolean
ags_math_util_match_operator (gchar *offset,
                              gchar *end_ptr,
                              gchar **start_offset,
                              gchar **end_offset);

Match operator.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_match_function ()

gboolean
ags_math_util_match_function (gchar *offset,
                              gchar *end_ptr,
                              gchar **start_offset,
                              gchar **end_offset);

Match function.

Parameters

offset

the string pointer

 

end_ptr

the end of offset

 

start_offset

points to start offset of matched, otherwise NULL.

[out][transfer none]

end_offset

points to end offset of matched, otherwise NULL.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_coefficient_to_complex ()

gboolean
ags_math_util_coefficient_to_complex (gchar *coefficient,
                                      AgsComplex *value);

Compute value from coefficient .

Parameters

coefficient

the coefficient string

 

value

return location of value.

[out][transfer none]

Returns

TRUE on success, otherwise FALSE

Since: 3.6.0


ags_math_util_multiply_coefficient_all ()

AgsComplex *
ags_math_util_multiply_coefficient_all
                               (gchar **coefficient,
                                guint *value_count);

ags_math_util_find_function ()

gchar *
ags_math_util_find_function (gchar *str);

Find next function.

Parameters

str

the string

 

Returns

the string offset matching function, otherwise NULL

Since: 3.2.0


ags_math_util_find_symbol ()

gchar *
ags_math_util_find_symbol (gchar *str);

Find next symbol.

Parameters

str

the string

 

Returns

the string offset matching symbol, otherwise NULL

Since: 3.2.0


ags_math_util_find_symbol_all ()

gchar **
ags_math_util_find_symbol_all (gchar *str);

Find all symbols.

Parameters

str

the string

 

Returns

the string vector containing the symbols

Since: 3.2.0


ags_math_util_is_term ()

gboolean
ags_math_util_is_term (gchar *term);

Test if term is a term.

Parameters

term

the term

 

Returns

TRUE on success, otherwise FALSE

Since: 3.2.0


ags_math_util_split_polynomial ()

void
ags_math_util_split_polynomial (gchar *polynomial,
                                gchar ***factor,
                                gchar ***factor_exponent);

Split polynomial into coefficient, powers of symbols and summand.

Parameters

polynomial

the polynomial

 

factor

the return location of factors.

[out]

factor_exponent

the return location of factor exponents.

[out]

Since: 3.2.0


ags_math_util_split_sum ()

void
ags_math_util_split_sum (gchar *sum,
                         gchar ***summand);

Split sum into summands.

Parameters

sum

the sum

 

summand

the return location of summands.

[out]

Since: 3.2.0

Types and Values

AGS_SYMBOLIC_EULER

#define AGS_SYMBOLIC_EULER "ℯ"

AGS_SYMBOLIC_PI

#define AGS_SYMBOLIC_PI "𝜋"

AGS_SYMBOLIC_INFINIT

#define AGS_SYMBOLIC_INFINIT "∞"

AGS_SYMBOLIC_COMPLEX_UNIT

#define AGS_SYMBOLIC_COMPLEX_UNIT "𝑖"

AGS_SUBSCRIPT_0

#define AGS_SUBSCRIPT_0 "₀"

AGS_SUBSCRIPT_1

#define AGS_SUBSCRIPT_1 "₁"

AGS_SUBSCRIPT_2

#define AGS_SUBSCRIPT_2 "₂"

AGS_SUBSCRIPT_3

#define AGS_SUBSCRIPT_3 "₃"

AGS_SUBSCRIPT_4

#define AGS_SUBSCRIPT_4 "₄"

AGS_SUBSCRIPT_5

#define AGS_SUBSCRIPT_5 "₅"

AGS_SUBSCRIPT_6

#define AGS_SUBSCRIPT_6 "₆"

AGS_SUBSCRIPT_7

#define AGS_SUBSCRIPT_7 "₇"

AGS_SUBSCRIPT_8

#define AGS_SUBSCRIPT_8 "₈"

AGS_SUBSCRIPT_9

#define AGS_SUBSCRIPT_9 "₉"