knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

mathmodels

The goal of mathmodels is to create a mathematical modeling toolbox with R, implement common mathematical modeling algorithms: evaluation, optimization, prediction, dynamics, graph theory, statistics, intelligence, etc.

Attention: The package is currently only a very very early version!

Installation

You can install the latest development version of mathmodels directly from GitHub use:

library(devtools) 
devtools::install_github("zhjx19/mathmodels")

Or download to current path, unzip and use:

install.packages("mathmodels-master", repos=NULL, type="source")

Example

This is a basic example which shows you how to solve a AHP problem:

library(mathmodels)
# pairwise comparison matrix
A = matrix(c(1,   1/2, 4, 3,   3,
             2,   1,   7, 5,   5,
             1/4, 1/7, 1, 1/2, 1/3,
             1/3, 1/5, 2, 1,   1,
             1/3, 1/5, 3, 1,   1), byrow = TRUE, nrow = 5)
# return: Weight vector, Consistency ratio, Maximum eigenvalue, Consistency index
AHP(A)


zhjx19/mathmodels documentation built on June 2, 2025, 12:18 a.m.