Giter Site home page Giter Site logo

fp1's Introduction

My Library: Math Library

My name: David Bui

Here, I tested out the math library and used several of the different pre-built functions. First, I made two 2x2 matrices and then performed some operations on them. Then I used functions from the basic operations part of the library and summed two randomly generated numbers. Next I did some array operations. Lastly I used a function from the statistics folder to count some samples from a list.

Here is the code with explanations:

(require math)

;; Make two 2x2 matrices
(define mymatrix (make-matrix 2 2 5))
(define test-matrix (matrix [[2 5] [3 8]]))
;; Add them
(matrix+ mymatrix test-matrix)
;; Subtract them
(matrix- mymatrix test-matrix)
;; Multiply all the values in the second matrix by a factor of 5
(matrix-scale test-matrix 5)
;; Multiply the difference of the second matrix by the first
(matrix* (matrix- test-matrix mymatrix))

;; Add two randomly generated numbers between two different ranges
(+ (random-integer 20 30) (random-integer 1 10))
;; Get the binomial of 7 and 2, 
(binomial 7 2)

;; Add the elements of a constructed array by the value 23
(array+ (array #[#[8 3 5 14]]) (array 23))
;; Multiply 30 to all the elements of a constructed array
(array-scale (array #[#[2 10 15]]) 30)

;; Get the list of samples in a list and count how many of each sample exist
(count-samples '(16 16 4 4 4 25 18 18 3))

My output from the .rkt file is as follows:

alt tag

Here is the diagram of some of the functions going on in my code:

alt tag

fp1's People

Contributors

buidavid16 avatar marksherman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.