# Note the context="setup". That's so that the question_ui_initialize methods from etude will be registered.
library(mosaic)
library(mosaicCalc)
library(ggformula)
library(math141Z)
library(etude)
library(learnr)
library(gradethis)
library(submitr)
library(basket)


learnr::tutorial_options(exercise.timelimit = 60,
                 exercise.checker = gradethis::grade_learnr)
submitr::login_controls()
options(tutorial.storage = "none")
vfun <- basket::check_valid
  #submitr::make_basic_validator(NULL, "hello")
storage_actions <- submitr::record_gs4("1jiV11I9tlEfAhRrkYqn6kPtkNma04TEpSCk-XMSuIRM", "statprep.annie@gmail.com", vfun)
  # submitr::record_local("./minimal_submissions.csv")
submitr::shiny_logic(input, output, session, vfun,
                     storage_actions)
# library(gradethis)
# library(etude)

Welcome

Welcome to the Math 141Z tutorials on using R for calculus.

These computing tutorials replace the "Working in RStudio" sections in the Kilty and McAllister Mathematical Modeling and Applied Calculus textbook. You can ignore those sections.

Each computing tutorial will have a layout similar to this document. For most browser setups, there are two columns in a tutorial. The left column gives the document title and a navigable table of contents. (If your browser window is very small, the table of contents will become a drop-down menu rooted in the title of the tutorial.)

The right column shows one page of the tutorial. There are typically several pages in a computing tutorial.

Every page in the tutorial has a login section. You are to use the computing ID [IN DRAFT: We need to establish the system for this.] and password that have been provided to you. When you see the "Login SUCCESSFUL" message, you are ready to go.

The login section appears at the top of every page so that you can confirm that you are correctly logged in or fix the situation if you are not.

The content of the page is displayed after the login section. Some pages, like this one, will consist only of text narrative. Other pages will have a mix of material, as you will see.

The page ends with one or more buttons to move to the next or previous page. You could do the same thing using the table of contents.

Explanatory material

Many pages will contain explanatory material and notes. Not surprisingly, some of this material will consist of illustrative computer commands and the output generated by them. For the sake of acquainting you with the format of such illustrative commands, here is an example. For the moment, don't worry about understanding the content of the command.

gf_point(kepler.radius ~ time, data = Kepler) %>%
  slice_plot(1.52 + 0.142 * sin(2 * pi  * time/687 - 300.3) ~ time)

The computer command appears in a grey box. The output from the command (if any) appears below. (The graph shows the distance of Mars from the Sun based on observations by Tycho Brahe (1546-1601) and analyzed by Johannes Kepler (1571-1630).)

Code boxes

The tutorials include facilities for you to write your own computer commands and evaluate them. This is done in "code boxes" such as the one below.

sqrt(47)

Often the code boxes will be pre-populated with text that you will edit in order to customize for some purpose. You press "Run code" to evaluate the code in the box.

Sometimes there will be a "Submit" button on the code box. You can work with the box to get the answer you want, testing as you go by pressing "Run code." Then, when you think you have worked out the right answer, press "Submit."

There's a mistake in the code box below. Fix it in order to calculate $\sqrt{477}$ and then submit your answer.

sqt(47)
gradethis::grade_result(
  pass_if( ~ .result == sqrt(477)),
  fail_if( ~ .result == sqrt(47), message = "We asked for the square root of 477. You need to do some more editing."),
  fail_if( ~ TRUE, message = "Keep trying!")
)

Multiple choice questions

Tutorials may also include multiple-choice questions. Here's a silly example. To see how things work, give an incorrect answer and then a correct one.

etude::choose_one(
  prompt = "Which  is a vowel?",
  list("+A+" = "The other vowels are E, I, O, U,  and sometimes Y.", "B" = "B is a consonant, not a vowel.", "C" = "C is a consonant."),
  random_answer_order = FALSE
)

Text answers

# indicate correct choices with +_+ in the name of the list item.
etude::essay_response(
  prompt = "Have you used computers before in a math class? If so, say what language was used.")

Submitting answers and starting over

When you are logged in to the document, all your answers will be saved to the 141Z instructors' database. This applies as well to the code when you press "Submit" in a code box.

If you are working on an assignment and think better of an answer that has already been submitted, just submit your new answer.

In all multiple-choice and essay questions, there will be a "Submit" button. You press this (of course!) to submit your answer. Caution: It's easy to forget to press submit, in which case your answer won't be recorded. Each time you press submit, you will get some feedback from the system, typically in a little green, yellow, or red box. Get in the habit of looking for this feedback.

It's particularly easy to forget to press "Submit" for code blocks, because those blocks also have a "Run code" button. "Run code" sends the code-block contents to R which then returns the result of the calculation. Other than this, there is no feedback of the sort you would see for multiple-choice and essay questions.

Pressing "Submit" from a code block will produce feedback. So get in the habit of looking for the feedback to make sure that anything that needs to be submitted will be.

Some code blocks will not have a "Submit" button. That's (usually) intensional on our part.

Underneath the table of contents is a small button labeled "Start over." This will erase the display of your previous answers in case you want to start over from a blank document, for instance to quiz yourself if you are studying for an exam.

Answers that you previously submitted by being logged in will not be erased. So you're safe.



dtkaplan/mosaicUSAFA documentation built on Aug. 21, 2021, 10:37 p.m.