Here are suggested solutions for the études. Of course, your solutions may well be entirely different, and better.

`(`

`ns`

`formulas.core`

`(`

`:require`

`[`

`clojure.browser.repl`

`:as`

`repl`

`]))`

`(`

`defonce`

`conn`

`(`

`repl/connect`

`"http://localhost:9000/repl"`

`))`

`(`

`enable-console-print!`

`)`

`(`

`defn`

`distance`

`"Calculate distance traveled by an object moving`

`with a given acceleration for a given amount of time"`

`[`

`accel`

`time`

`]`

`(`

`*`

`accel`

`time`

`time`

`))`

`(`

`defn`

`kinetic-energy`

`"Calculate kinetic energy given mass and velocity"`

`[`

`m`

`v`

`]`

`(`

`/`

`(`

`*`

`m`

`v`

`v`

`)`

`2.0`

`))`

`(`

`defn`

`centripetal`

`"Calculate centripetal acceleration given velocity and radius"`

`[`

`v`

`r`

`]`

`(`

`/`

`(`

`*`

`v`

`v`

`)`

`r`

`))`

`(`

`defn`

`average`

`"Calculate average of two numbers"`

`[`

`a`

`b`

`]`

`(`

`/`

`(`

`+`

`a`

`b`

`)`

`2.0`

`))`

`(`

`defn`

`variance`

`"Calculate variance of two numbers"`

`[`

`a`

`b`

`]`

`(`

`-`

`(`

`*`

`2`

`(`

`+`

`(`

`*`

`a`

`a`

`)`

`(`

`*`

`b`

`b`

`)))`

`(`

`*`

`(`

`+`

`a`

`b`

`)`

`(`

`+`

`a`

`b`

`))))`

`(`

`def`

`G`

`6.6784`

`e-11`

`)`

`(`

`defn`

`gravitational-force`

`"Calculate gravitational force of two objects of`

`mass m1 and m2, with centers of gravity at a distance r"`

`[`

`m1`

`m2`

`r`

`]`

`(`

`/`

`(`

`*`

`G`

`m1`

`m2`

`)`

`(`

`*`

`r`

`r`

`)))`

`(`

`defn`

`monthly-payment`

`"Calculate monthly payment on a loan of amount p,`

`with annual percentage rate apr, and a given number of years"`

`[`

`p`

`apr`

`years`

`]`

`(`

`let`

`[`

`r`

`(`

`/`

`(`

`/`

`apr`

`100`

`)`

`12.0`

`)`

`n`

`(`

`*`

`years`

`12`

`)`

`factor`

`(`

`.pow`

`js/Math`

`(`

`+`

`1`

`r`

`)`

`n`

`)]`

`(`

`*`

`p`

`(`

`/`

`(`

`*`

`r`

`factor`

`)`

`(`

`-`

`factor`

`1`

`)))))`

`(`

`defn`

`radians`

`"Convert degrees to radians"`

`[`

`degrees`

`]`

`(`

`*`

`(`

`/`

`(`

`.-PI`

`js/Math`

`)`

`180`

`)`

`degrees`

`))`

`(`

`defn`

`daylight`

`"Find minutes of daylight given latitude in degrees and day of year.`

Start Free Trial

No credit card required