Examples

Announcements of available shared folders

Examples

Postby oliver » Fri May 07, 2010 12:26 pm

This folder contains example JavaScript and RPL math functions.

gcd_JS takes two numbers and computes the greatest common divisor.
gcd_RPL does the same in RPL using recursion
GCD_RPL does the same in RPL+ using recursion using a local variable
fib_JS takes one number and computes the nth value in the Fibonacci Series.
randM takes a matrix and randomizes its elements, in JavaScript
randM_RPL takes a matrix and randomizes its elements, in RPL
divs_RPL produces a vector of divisors, given an integer, in RPL
divs_RPL28 produces a vector with divisors, given an integer, in RPL for the HP-28S
randV produces a randomized array given an input integer for its size, in JavaScript
randV_RPL produces a randomized array given an input integer for its size, in RPL
bench requires the Bench folder and benchmarks how long it takes to produce an vector of 1000 elements using randomV
digitSum takes an integer and computes its sum of digits
NEXTPRI finds the next prime number following a given integer
Fib720 produces a vector of the first 720 Fibonacci numbers, in RPL
GROBtest employs hp 50g code to construct an image; to display, evaluate it
twoV2M builds a matrix from two input vectors; use to mesh two vectors; for example mesh x's and y's for use by linePlot()
diffsOfVec returns a vector with inter-component differences of the input vector
Gamma is a complex-capable version of the Gamma function in RPL
Gpuzzle finds the first 10-digit prime in consecutive digits of e, and is the Goggle Billboard Challenge; this function needs the APConstants folder; no input parameters
Gpuzzle2 is the second part of the Google Billboard Challenge and finds numbers with a certain digit sum; no input parameters
Graham_RPL is an RPL version of Graham from the APConstants folder. It computes the last digits of Graham's number; takes an integer as input parameter: the number of desired ending digits

Examples
gcd_JS(32, 12) = 4
fib_JS(8) = 21
1000, randV produces a random 1000-element integer vector
[1,2,3,4] [5,8,9,3] twoV2M produces [[1,5],[2,8],[3,9],[4,3]]
20 Graham_RPL produces "...4575627262464195387"

You can use these functions as programming study guides and see how a shared folder is formatted.
(Note the entries under Credits & Notes.)
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: Examples

Postby oliver » Tue Mar 22, 2011 3:41 am

Entries have been added and a couple, which moved into the Challenges folder, have been removed.
The first post has been added to reflect the changes.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: Examples

Postby oliver » Thu Mar 24, 2011 9:27 am

Five more additions.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: Examples

Postby oliver » Tue Jan 03, 2012 6:36 pm

Three more additions. And one fix in randV_RPL.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm


Return to Downloadable Folders / Shared Data

Who is online

Users browsing this forum: No registered users and 1 guest

cron