Message Boards Message Boards

9
|
2748 Views
|
86 Replies
|
27 Total Likes
View groups...
Share
Share this post:
GROUPS:

[WSG24] Daily Study Group: Elementary Introduction to Wolfram Language

Posted 2 months ago

enter image description here A Wolfram U Daily Study Group on Elementary Introduction to Wolfram Language begins on Monday, September 16.

Join me and Eryn Gillam and a group of fellow learners to learn about programming in Wolfram Language. Our topics for the study group include list manipulation, using and making functions, using dynamic functionality, and working with images, sounds, shapes, and colors.

No prior Wolfram Language experience is required.

Please feel free to use this thread to collaborate and share ideas, materials and links to other resources with fellow learners.

Dates and Times:

September 16th-October 4th, 11am-12pm CT (4-5pm GMT)

Register Here

POSTED BY: Rory Foulger
86 Replies
Posted 1 month ago

I will keep playing around with it and learn how to get the data structures that I need. That what I am trying to do now is learn how to perform some of the transformations that I am used to from using R

@Jim, I noticed there's a Wolfram U course Combine Wolfram Language and R (in French) coming up on October 22. The one-day seminar's description:

This webinar will explore ways to use Wolfram Language and R together in an integrated workflow. We focus on RLink, a built-in feature of Wolfram Mathematica that allows you to execute R code from Mathematica's native environment and transfer data seamlessly between the two languages. We will also show RLink's high-level basic functions. The webinar will explore real-time examples of workflows combining both Wolfram Language and R's capabilities. This webinar will be of particular interest to users of both languages, regardless of their level of expertise, since RLink allows them to rely on the knowledge of their preferred language to perform common operations while using the advantages of the other language. Users experienced in both languages can benefit from using RLink to call both languages from the same environment.

The User Guide for RLink is here. The presentation is obviously in French, but there are tools available to transcribe audio, and that transcript could be easily translated to English. One or the other of those may be useful in your explorations. Bon voyage!

POSTED BY: Phil Earnhardt
Posted 1 month ago

Thanks for the feedback, Phil!

POSTED BY: Héctor Galaz
Table[Range[n],{n,1,5}]

Above will work but trying to replace {n,1,5} with Range not successful:

Table[Range[n], Range[n,1,5]]

https://i.redd.it/8jft5i5fhjtd1.png

POSTED BY: Rajeev Bagra

Not sure why the exercise (Operations on Lists, 5.4) is grading it wrong. enter image description here

POSTED BY: Rajeev Bagra

Not sure why the exercise (Operations on Lists, 5.4) is grading it wrong. enter image description here

POSTED BY: Rajeev Bagra
Posted 1 month ago

Hello, does anyone have errors when checking the solution for the lesson exercises in the interactive course framework at Wolfram U?

Yes. Several class participants have commented here. A fair number of correct answers get scored as incorrect, and a tiny number of incorrect answers get scored as correct. From what you described, you've clearly spent a lot of time going through those exercises.

My guess is that nobody on staff has run though all of the EIWL (third edition) exercises in a while. I'm guessing that none of the staffers associated with this course ran (walked? slogged?) through the exercises and reported problems they noticed. If you listen closely, Cassidy was emphasizing passing the quizzes and getting that certification. I think that's a good strategy.

There may be a structural problem with the EIWL exercise framework. I believe the computational resources for the EIWL interactive course run on the individual user's Wolfram Cloud account. The amount of computation resources for a free Wolfram Cloud account are limited. The entire exercise/grading engine chews up fair amount of resources -- especially on the Entity and GeoGraphics problems. And you can easily run through many questions in a session when you change between exercises chapters in the framework. It's possible the "something went wrong with grading" problems are happening because your personal account has run out of computrons. Here's the kicker: if there is a potential resource problem when actively using the EIWL framework, then Wolfram Research staffers -- with far larger resource quotas on their accounts -- probably would never hit those computational quotas. They would have a real problem reproducing any issues you might encounter.

It would be nice if @Wolfram-U could do some forensics on your Wolfram Cloud account and see if you bumped up against its resource limits in the past 1-2 weeks. If you really want to pursue your issues, this is the most likely way you have to get a resolution. E-mail wolfram-u@wolfram.com . If you'd get any answers, please post a message to this community forum. Thanks!

here I can check the solutions without error, but this way the tracking of the exercises doesn´t count at Wolfram U course for following my progress...

My personal advice is to not bother with the cert you get by completing the EIWL exercises. Work around the road-blocks and do as many of them as possible. If you do 90%+ of them, you have done the work. I think you will do just fine on the Wolfram Language Level 1 certification test. If you check over the Calculus interactive course, I think you'd do just fine on the Mathematica Level 1 cert also.

I think the EIWL interactive course exercises are outstanding. They require the kind of "fill in the blanks" thinking that the learning experts have identified as the best way to learn new material. IMHO, they are far better than any quizzes that Wolfram Research has for their other courses. The real goal is to be writing code, and you can start doing that with the EIWL exercises. At the same time, the grading engine appears to be a bit of an abandoned child in the Wolfram Research education portfolio. :(

Good work on what you've done in the exercises. I was going through the framework about 9 months ago (on my own). I got about 95% of the way through and gave up. I saw most of the failures you saw; I don't remember if I got the "something wrong with grading" error. I got the strong sense it was a Wolfram Cloud computational quota problem, but that could be completely wrong.

CC @Jamie Peterson (of Wolfram U). I really love/hate this material. It sounds like Héctor does, too.

POSTED BY: Phil Earnhardt
Posted 1 month ago

@Jim, I think a straightforward approach is to use SemanticImportString to go from your input (a string) to a Dataset. That's what I did in my example:

giltour = Import["Downloads/gil-tour.txt", "Text"];
tourdata = SemanticImportString[giltour];
datesortedtour = tourdata[SortBy["column2"]];
GeoListPlot[
 Table[Interpreter["City"][datesortedtour[All, "City"][[n]]], {n, 1, 
   Length[datesortedtour]}], Joined -> True, GeoLabels -> True]

I've added the text file it imports to this message so you can run it yourself.

You haven't ever shown us your input file, but I'm pretty certain that SemanticImportString will whack it into the Dataset that you need. Did you try using SemanticImportString? Regular Expressions work in the WL, but they seem to be second class citizens here. There's no function that will take a string, process its regular expressions, and return a Dataset. Even the writeup for RegularExpression documents that functionality in terms of other WL functions. Please try out that sophisticated WL function to grind through your input text.

Attachments:
POSTED BY: Phil Earnhardt
Posted 1 month ago

Here is the code that I was using to parse some strings and then create a dataset from them. I guess the problem is when Mapping some of the expressions the result is a list and then this is included in a larger list. Really want to get the result without the List property, so to remove in as I have to now. The other problem is that when using RegularExpression is that the matches are returned as String and I will have to convert that later to Integer for processing.

In[553]:= lineSplit // InputForm

Out[553]//InputForm=
{{"Game 1", " 3 blue, 4 red", " 1 red, 2 green, 6 blue", " 2 green"}, 
 {"Game 2", " 1 blue, 2 green", " 3 green, 4 blue, 1 red", " 1 green, 1 blue"}, 
 {"Game 3", " 8 green, 6 blue, 20 red", " 5 blue, 4 red, 13 green", " 5 green, 1 red"}, 
 {"Game 4", " 1 green, 3 red, 6 blue", " 3 green, 6 red", " 3 green, 15 blue, 14 red"}, 
 {"Game 5", " 6 red, 1 blue, 3 green", " 2 blue, 1 red, 2 green"}}

In[549]:= fxx[arg1_] := Module[{game, sets},
  game = StringCases[RegularExpression["(\\d+)"] -> "$1"][First[arg1]][[1]];
  sets = StringCases[RegularExpression["(\\d+) (\\w+)"] -> "$2" -> "$1"][
    Rest[arg1]];
  <|Flatten[{"game" -> game, "blue" -> 0, "red" -> 0, "green" -> 0, #}]|> & /@
    sets
  ]

In[550]:= fxx /@ lineSplit (* this results in the List-of-Lists *)

Out[550]= {{<|"game" -> "1", "blue" -> "3", "red" -> "4", 
   "green" -> 0|>, <|"game" -> "1", "blue" -> "6", "red" -> "1", 
   "green" -> "2"|>, <|"game" -> "1", "blue" -> 0, "red" -> 0, 
   "green" -> "2"|>}, {<|"game" -> "2", "blue" -> "1", "red" -> 0, 
   "green" -> "2"|>, <|"game" -> "2", "blue" -> "4", "red" -> "1", 
   "green" -> "3"|>, <|"game" -> "2", "blue" -> "1", "red" -> 0, 
   "green" -> "1"|>}, {<|"game" -> "3", "blue" -> "6", "red" -> "20", 
   "green" -> "8"|>, <|"game" -> "3", "blue" -> "5", "red" -> "4", 
   "green" -> "13"|>, <|"game" -> "3", "blue" -> 0, "red" -> "1", 
   "green" -> "5"|>}, {<|"game" -> "4", "blue" -> "6", "red" -> "3", 
   "green" -> "1"|>, <|"game" -> "4", "blue" -> 0, "red" -> "6", 
   "green" -> "3"|>, <|"game" -> "4", "blue" -> "15", "red" -> "14", 
   "green" -> "3"|>}, {<|"game" -> "5", "blue" -> "1", "red" -> "6", 
   "green" -> "3"|>, <|"game" -> "5", "blue" -> "2", "red" -> "1", 
   "green" -> "2"|>}}

I will keep playing around with it and learn how to get the data structures that I need. That what I am trying to do now is learn how to perform some of the transformations that I am used to from using R

POSTED BY: Jim Holtman
Posted 1 month ago

Hello, does anyone have errors when checking the solution for the lesson exercises in the interactive course framework at Wolfram U?

Example: https://www.wolframcloud.com/obj/online-courses/an-elementary-introduction-to-the-wolfram-language/01-starting-out-elementary-arithmetic.html, but I get errors when checking the solution for any lesson: "Unfortunately, something went wrong with grading".

Same error if I download the exercise notebooks from Wolfram U interactive course.

Strangely, error doesn´t appear if I read the EIWL online, which redirects to the Wolfram Cloud for solving the exercises (second edition of EIWL, not third edition):

https://www.wolfram.com/language/elementary-introduction/3rd-ed/01-starting-out-elementary-arithmetic.html;

https://lab.wolframcloud.com/env/a5ef730a-f521-4f35-96f7-f8d428bf0746#sidebar=eiwl/01-starting-out-elementary-arithmetic

here I can check the solutions without error, but this way the tracking of the exercises doesn´t count at Wolfram U course for following my progress...

POSTED BY: Héctor Galaz
Posted 1 month ago

You're creating a Dataset with a list of lists of associations. What does it mean to create a Dataset with a list of list of associations? I don't know; that is kind of a funky structure. Creating a Dataset out of a list of list of associations doesn't magically remove (i.e., Flatten) that secondary structure. The entries in your Dataset are Associations. That makes no sense -- it doesn't make any sense to me. The Wolfram Language is rather promiscuous; it will let you do all sorts of things that might make no sense programatically.

That promiscuity extends to displaying dubious expressions: it tries the best it can. It looks like a simple Dataset, but using FullForm will show the whole structure:

listOfLists // Dataset // FullForm

A sane Dataset is created if you Flatten your list-of-lists input first:

listOfLists // Flatten // Dataset // FullForm

Run those 2 expressions and note that the output is dramatically different.

Anyone know what is causing the problem?

The fundamental problem is that you haven't ever specified what you're trying to do. It looks like you're trying to create a Dataset that has a two-level hierarchy with a list of games. Defining that as a list-of-list of associations appears to not work. Instead, you want to create a single list of associations, and have each of those associations have some structure within them.

I asked my friendly neighborhood AI how one would go about doing that:

how do you create a nested database in the Wolfram Language

It provided two examples. Here's the first:

data = {
  <|"game" -> "Game 1", 
    "players" -> {
      <|"name" -> "Alice", "score" -> 5|>, 
      <|"name" -> "Bob", "score" -> 7|>
    }|>, 
  <|"game" -> "Game 2", 
    "players" -> {
      <|"name" -> "Alice", "score" -> 8|>, 
      <|"name" -> "Charlie", "score" -> 6|>
    }|>
};

dataset = Dataset[data]

I ran that. If you create that Dataset, you'll see the 2-level structure in place. Row and column selection should work just fine on that Dataset. The structure is created in each association, but only one simple list of those associations is passed to create the Dataset. I strongly recommend asking questions like this to ChatGPT; it has a great breadth of knowledge in the Wolfram Language. Just be a skeptic and double-check everything it gives you. Don't be thrown if ChatGPT gives you a slightly different response to the response I showed above. The reply that Chat gives to any question is influenced by the context of the earlier conversation. A poet might call that the butterfly effect of AIs: getting a different response when two questions appear to be identical.

@Jim Holtman, I think these are great explorations. EIWL gives a broad introduction to the language, but it doesn't go into great depth of any of them. You're exploring something beyond the flat Datasets that were shown in the book and course. I definitely learned something by poking around with your question. I fondly hope my response was helpful.

POSTED BY: Phil Earnhardt
Posted 1 month ago

I am having problems with managing Lists. My processing has created a List-of-Lists which seems to create a Dataset, but produces a error when trying to access a column (I have an attached file with the notebook is interested):enter image description here

Here is the same data file where I have (manually) removed the interior lists by removing the enclosing '{}'. This seems to produce the same dataset, but now I can access the columns:enter image description here

Anyone know what is causing the problem?

Attachments:
POSTED BY: Jim Holtman
Posted 1 month ago

If you looked at the "Traveling Educator" message that I posted here -- the big path on a US map -- you'll see that I had simple text that I was importing into a Dataset. I used SemanticImportString to import that data. There was a bug in my interpretation and my output: my data source had put "Sat" before a date in the table I imported. Look at the output in the dataset: the SemanticImport left that field blank in the dataset it generated. All things equal, I wish that SemanticImportString had generated an error when it saw that unanticipated day-of-week, but it silently put a blank field in. The function didn't complain, and I missed the buggy entry in my database.

You have some blank spots in your data. Whether or not you have blank spots, you need to canonicalize your input. If you're exporting from some database, it should already be canonicalized. If your input isn't coming from a database, you have your choice of tools to massage it. If privacy is not an issue, you could even use ChatGPT to put your data into a form more palatable to input into a database -- any database.

I did one manual massage on my data. Gil had listed Minneapolis St. Paul as a "city" in his list. This is completely understandable by humans what he means -- the twin cities -- but it befuddled the Wolfram Language to put a place-marker for that non-city.

Importing data is definitely a black art. Importing your data will probably wind up being the most difficult part of your task. I suggest downloading the ".txt" file I included with that message, running the code, and scrutinizing the intermediate results. I suspect that some flavor of SemanticImport is what you need.

POSTED BY: Phil Earnhardt

Agreed Soomi, this question seems a little tough to parse. Glad you found a solution!

POSTED BY: Rory Foulger

I do enjoy using these AI tools to help solidify understanding!

POSTED BY: Rory Foulger

Heya! This is a great solution and fixes your issue!

I was looking at your example, and I think that Dataset isn't actually supposed to have this behavior, so I've reported a bug. We'll see what the team says!

POSTED BY: Rory Foulger
Posted 1 month ago

Thanks for the input. I had looked at sorting and that will work if I have all the values. I am reading in some data that has hundreds of records and many may be missing one, or more, of the fields. What is hard is determining which ones are missing. Since these are Associations I was thinking that I would initialize with a string with all the fields being Missing <|"field"->Missing, "field"->43|> and then add the fields from each record. If there are valid ones at the end of the Association, they should be the ones that are defined [in the example, "field" would be 42]. Will try that out to see if it works. It does work. I put all the fields that I know are in the data at the start of the association initialized to 0, and then follow it with the actual data. Since an association only keeps that last value defined, it works out and also "sorts" the data in the order of the fields that are input. So with a little processing I can get that data I want.enter image description here

POSTED BY: Jim Holtman
Posted 1 month ago

For the out-of-order associations, just sort the keys them before you use 'em to create the Dataset:

KeySort /@ {<|"game" -> 1, "blue" -> 2, "red" -> 3|>, <|"game" -> 2, "red" -> 42, "blue" -> 53|>} // Dataset

IDK exactly how to create datasets with missing key/values in the associations. It appears you can put Missing[] in for missing values in the association:

assoc = <| "Name" -> "Alice", "Age" -> Missing["NotAvailable"], (* Missing value for "Age" *) "City" -> "New York" |>

Look up Missing[] in the docs.

POSTED BY: Phil Earnhardt
Posted 1 month ago

I just found a new tool for expanding your understanding of the Wolfram Language. If you ask ChatGPT:

give me a natural-language explanation of what Graphics[ Table[{Hue[RandomReal[]], Line[RandomReal[1, {2, 2}]]}, {100}]] does in the wolfram language

I'll show the response as a graphic, since ChatGPT puts in some nice formatting:

enter image description here

That code is from the Neat Examples section of the Wolfram Language Documentation for Line . The really nice part is the breakdown that ChatGPT gives for the code. Using Chat to generate snippets of code from natural language is pretty well-known; using Chat to provide lucid explanations of a code fragment is a new one for me. Warning: ChatGPT (and all the AIs) will give out wrong answers. Read what the AI has said, and make sure that the response is actually intelligent. As a famous politician once said, "Trust, but verify."

POSTED BY: Phil Earnhardt
Posted 1 month ago

I am trying to create a Dataset, but have problems if the order of the columns is not the same, or I have cases where some column values are missing. Here is an example of creating one correctly: enter image description here

Here is what happens if the columns are out of order: (you no longer have the relationships of "rows" of data) enter image description here I was hoping that they would align correctly. Is there an option/easy way of fixing this. The last case is where a column may be missing (would like if filled in with "Missing" or zero enter image description here I am used to working in R where these cases are handled with the way that R creates datasets

POSTED BY: Jim Holtman
Posted 1 month ago

Rory was commenting today that assigning values to variables happens in the final third of EIWL -- a noteworthy choice. In his announcement of the Elementary Introduction to the Wolfram Language book (2015), Stephen Wolfram had some interesting things to say on this topic. He also had interesting commentary elsewhere about individuals who started with the Wolfram Language parachuting into other language. If you open that up and search for "functional programming", you'll find this:

But what happens when someone who’s learned programming in the Wolfram Language wants to do low-level programming in C++ or Java? I’ve seen this a few times, and it’s been quite charming. They seem to have no difficulty at all grasping how to do good programming in these lower-level languages, but they keep on exclaiming about all the quaint things they have to do, and all the things that don’t work. “Oh my gosh, I actually have to allocate memory myself”. “Wow, there’s a limit on the size of an integer”. And so on.

The transition from the Wolfram Language to lower-level languages seems to be easy. The other way around it’s sometimes a little more challenging. And I must say that I often find it easier to teach computational thinking to kids who know nothing about programming: they pick up the concepts very quickly, and they don’t have to unlearn the idea that everything must turn into loops and conditionals and so on.

The WL is a challenging beast to wrap your head around. Stephen is proposing that that difficulty is not really his fault. :)

POSTED BY: Phil Earnhardt
Posted 1 month ago

The question asked during class about Lambda in Python was appreciated! I noticed the following Question/Answer online on the GeeksforGeeks page on Python Lambda Functions.

Q: What is the functionality of lambda?

A: The functionality of lambda functions in Python is to create small, anonymous functions on the fly. They are often used in situations where creating a full-fledged function using def would be overkill or where a function is needed for a short period and doesn’t need a name.

That definitely fits the exact way that Pure Anonymous Functions are used in the Wolfram Language. It's pretty wild that anonymous functions are taught in EIWL before we ever see how to write named procedures. Stephen commented somewhere that kids who see functional programming and never learn procedural styles don't feel that anything is missing. You can definitely see his preferences and thinking oozing out of this text.

Anyone interested in the great thinking around Lambda and functional programming should check out the Steele/Sussman papers on Lambda and Lambda Calculus from the 1975-1980. They make a convincing case for functional programming, including debunking the idea that procedure calls in functional programming are "expensive". They're not formal science papers; they're passionate and witty on their topics. Both enthusiasts and critics of functional programming would learn something from them. Guy Steele went on to write "C: A Reference Manual" in 1984. That book was probably on the bookshelf of every C programmer around. C is about as procedural and non-functional as any language out there. Go figure. Steele went on to be one of the creators of the Java Programming Language at Sun Microsystems.

Sussman is a Computer Science professor at MIT. His big claim to fame is Numerical Evidence that the Orbit of Pluto is Chaotic. This is a big deal: if the planet Pluto's orbit is chaotic, then the motion of all planets, the galaxy, and the universe at large is chaotic. If you tell me that Pluto is only a dwarf planet, I will hit you. Pluto was a planet when these scientists wrote their paper, and the principles are still applicable. Newton's "clockwork universe" is broken, and most of us haven't gotten the memo. If you're curious why Newton and Kepler and Tycho Brahe never figured out that solar system mechanics were chaotic, then read this Wikipedia article. At best, we've been observing for a couple of thousand years; we'd need to watch for a few tens of millions of years to see any divergence. In short, Sussman and Steele pioneered the beginnings of functional programming -- and also did loads of other important stuff.

Stephen has blogged about Lambda Calculus; he clearly thinks in a similar fashion. I don't think Stephen ever collaborated with the "Lambda the Ultimate [xxx]" crowd, but I could be mistaken. Understanding functional programming is tremendously helpful in understanding the Wolfram Language.

Back to the exercises. Lambda on!

POSTED BY: Phil Earnhardt
Posted 1 month ago

No file was attached to your message.

POSTED BY: Phil Earnhardt

Please check the attached file link. I am getting an error message.

POSTED BY: Taiboo Song
Posted 1 month ago

After coming back from my running of the day for refresh, I read your respose (THANK YOU!), Jingzhou Na. Then, I read my question. Ah-ha! Now, I understand that it was, yes, rambled, but the correct English. However, again, lol... Is there any crystal-clear expression on it? "a random multiple of tenths of a second up to 10 tenths of a second"

THANK YOU again, Jingzhou Na.

Attachment

Attachments:
POSTED BY: Soomi Cheong
Posted 2 months ago

The interesting part of this question in my mind is that: RandomInteger[10] is picking an integer from {0,1,2,3,4,5,6,7,8,9,10} which includes 0. So a Note with 0 time will simply disappear. I think a few run of the code you can find some evaluation only having 9 (or less) "real" Notes. In theory, it is possible this piece of code generate nothing.

POSTED BY: Jingzhou Na
Posted 2 months ago
  • 12.7
    Generate a sequence of 10 notes with random pitches up to 12 and random durations equal to a random multiple of tenths of a second up to 10 tenths of a second. -> what does "a random multiple of tenths of a second up to 10 tenths of a second" mean? I think that it is rambled. My idea is that it may mean "RandomInteger[10]/10." Thus, I tried and "Correct" Answer was marked. Then, is that the correct English expression???
POSTED BY: Soomi Cheong
Posted 2 months ago

One guess: Phil is working on a previous version of exercise notebook that has not fixed this specific issue.

I'm definitely using the current version of the framework. I have no idea how to access any previous version. I told @Soomi there were places where the wrong answer would get scored as correct. This is one.

POSTED BY: Phil Earnhardt
Posted 2 months ago

Very interesting. The "expected output" in my interface is indeed the true solution to the question (satisfying the question): when n=5, it has 5 colors and so on.

The 2nd edition solution (or the "expected output" in Phil's interface) has 6 colors when n=5, which is a false solution to the question (it does not satisfy the question).

I believe Phil's solution marked as "correct" is the true solution. There is something going wrong with the "expected solution" in Phil's interface but not in mine, which is interesting.

One guess: Phil is working on a previous version of exercise notebook that has not fixed this specific issue. Then the wrong "expected output" matches the wrong solution in 2nd edition of the book.

Attachment

Attachments:
POSTED BY: Jingzhou Na
Posted 2 months ago

If you look at the Track My Progress page at the very bottom of the left-hand navigator for the course, you will see a Certification Progress section. If you hover your mouse over each of the white or orange blocks for the videos and exercises , you can see the Chapter number that is supposedly relevant to that quiz#. So, you can see that the quizzes don't necessarily correspond to groups of successive chapters. But you can still pass Quiz 1 without having completed all the chapters and exercises relevant to Quiz 1. That might not work with the rest of the quizzes, however.

Maybe it's best to complete all the chapters, then do the quizzes.

POSTED BY: Updating Name
Posted 2 months ago

Ex9.7 and Ex14.7 does not work, the solutions are wrong in the sense that the output is not the same as desired output (does not satisfy the question)

You are awfully fast, @Jingzhou Na. We weren't ignoring you; we're just trying to catch up. :) I'm only up to 9.7. I can confirm that there's something broken with that question. If I put in an answer scored as correct, I get different behavior than the "expected output". With an input value of 5 to both manipulates, the "expected output" displays 6 colors. My "correct" output displays 5 colors. That ain't right. I covered over my submitted answer: enter image description here

POSTED BY: Phil Earnhardt
Posted 2 months ago

Our discussion of GeoListPlot today reminded me about a short project I did a while back. In the fall of 2023, my good friend Gil Hedley announced his Nerve Tour, a 111-city one-day educational tour through the United States and Canada. I remember thinking, "Aha! He hasn't done a computational plot of his tour. I can do that in the Wolfram Language." Here's the code I came up with:

giltour = Import["Downloads/gil-tour.txt", "Text"];
tourdata = SemanticImportString[giltour];
datesortedtour = tourdata[SortBy["column2"]];
GeoListPlot[
 Table[Interpreter["City"][datesortedtour[All, "City"][[n]]], {n, 1, 
   Length[datesortedtour]}], Joined -> True, GeoLabels -> True]

The results are rather spectacular:

Map of Gil's 2023-24

If anyone would like to run the code, I have attached the gil-tour.txt file to this message. Warning: it takes several minutes to run on my Apple M1 MacBook Pro. YMMV (that seems like an appropriate acronym). This is the actual route that Gil computed [manually] and is taking.

It occurred to me that Gil's schedule is a variation of the "Traveling Salesman Problem". It's the Traveling Educator Problem. The Wolfram Language has support for solving that kind of problem. I may try that in the next few days. If anyone is interested in coding the shortest path for Gil's education odyssey, have at it. One note: Gil was using a camper for his housing during the tour. He toured cities up north in warm weather and southern cities in the winter months. If you wanted to best Gil's manually-constructed path, your solution would have to reflect similar seasonal constraints.

Code like this is fully within the capability of anyone in this course. You just have to have the proper drive/curiosity to find a problem you'd like to solve in the language. Have at it!

Attachments:
POSTED BY: Phil Earnhardt
Posted 2 months ago

I have thought that this daily study group community threads help Wolfram improve their publishing/published study materials. Thus, although it takes time for us to post issues while studying, it is also one thing that we, daily study group attendees, can do for Wolfram as an expression of our appreciation for teaching us and granting us the public access to their great knowledge-based materials and lectures.

Personally, to me, this community threads help me learn that I am not alone to have the issues and can also learn from others by exchanging our experiences, and academic and empirical knowledge. I appreciate Wolfram, in particular, Wolfram U Team, who hosts and administers classes to the public for free. Moreover, I am grateful to all attendees of Wolfram classes to share their knowledge, experiences, and wisdom.

I have been thinking that we appreciate the instructors in general. However, it is easy for us to forget other Wolfram staff who make the classes run well.

THANK YOU, Rory and Eryn for teaching us. I know very well how much time you invest to teach us.

THANK YOU, Cassidy, Roberto, Christine, and Wolfram System Engineers!

What Wolfram does to the public makes a big difference on learners' ends!!! My experience says that Wolfram, in particular, Wolfram Instructors, knows about it very well.

THANK YOU, all other Wolfram attendees!

It's fall now, although it's still sweltering during the daylight due to the global warming (too sweltering.. I am allergic to Sun (lol)). Have an amazing Fall, everyone! See you around...

Sincerely,

Soomi Cheong

POSTED BY: Soomi Cheong
Posted 2 months ago

As I know, Wolfram Server has been down or does some batch jobs (?) sometime around midnight. It goes very slowly and sometimes is disconnected. This is an ongoing issue, not just for this daily group.

As I recall, Wolfram system engineers/programmers also monitor current daily study group's community to refer to any system-related issues. Thus, I post this message here.

POSTED BY: Soomi Cheong
Posted 2 months ago
Table[Part[{Red, Yellow, Green}, RandomInteger[2] + 1], 100]

I tried 3 out 5 of your solutions as well. Eventually I lost my interest exploring all possibilities of different syntax giving a desired solution (at least for this one, and for some questions that does not allow changing variable names >W<, also in sec 16 about nature language expressions)

If you are really struggle with the syntax like me do, the 2nd edition solution can be found and apparently some of the solutions work for 3rd edition as well (Ex 9.7 does not work, it is even a wrong solution, I believe they fixed that in 3rd edition)

https://www.wolfram.com/language/elementary-introduction/2nd-ed/answers-to-exercises.html

POSTED BY: Jingzhou Na
Posted 2 months ago

Thank you for your response. I see the problem now. I used Capitalize and the problem states 'uppercase'.

POSTED BY: Patrick Brooks
Posted 2 months ago

I believe your answer is one correct way, but the system does not have that in the solution checker. I tried ToUpperCase[StringJoin[Alphabet[]]]

I agree that the checker is often too picky, but I agree with the checker in this case. Capitalize[] capitalizes the first letter of a string; ToUpperCase[] returns a string all in upper case. The results in this example are the same, because the strings are all one letter long. If the example had used samples from WordList[] rather than Alphabet[], then Capitalize[] would have given the incorrect result.

Part of the point of these exercises is to discover new functions. The words for the exercise are usually chosen carefully. If you get stuck on a problem, one possibility is to put words from the exercise instructions into the Wolfram Language & System Documentation Center search box and see what functions pop up. Or look in the guidelines for a major area of the documentation -- like Strings & Text. I liked Rory's comment today where [I believe] he said he spends the majority of his day inside of the documentation.

POSTED BY: Phil Earnhardt
Posted 2 months ago

Problem solved for ex16.1, correct answer is

EntityValue[Entity["Country", "Switzerland"], EntityProperty["Country", "Flag"]]

It seems for ex16.1, the system really want "everything". I used "Flag" for second argument and the checker marks it as "incorrect" (only for ex16.1) EntityValue[Entity["Country", "Switzerland"], "Flag"]

I believe the exercise is to recognize the first argument is an "Entity" and the second argument is an "EntityProperty". However, I want to mention that for later ex16.x, the checker does not want "everything". For example in ex16.4, the correct answer would be BarChart[EntityValue[EntityClass["Planet", All], "Mass"]]

but if you use the "everything" involved code as in ex16.1 (by changing "Mass" to EntityProperty["Planet", "Mass"]) BarChart[EntityValue[EntityClass["Planet", All], EntityProperty["Planet", "Mass"]]]

the checker will mark it as "incorrect".


Something more about ex16.x involving "Species": There is a high chance that control= will direct you to the correct animal, but "incorrect" InputForm that the checker will mark it as "incorrect". For example, in ex16.13 (the last ex16) control= "koala" gives me the koala picture as the desired output. When I copied the code here, it shows the following

ImageAdd[Entity["TaxonomicSpecies", "PhascolarctosCinereus::2kft4"]["Image"], Entity["Country","Australia"]["Flag"]]

In the notebook, Entity["TaxonomicSpecies", "PhascolarctosCinereus::2kft4"] will be compressed as a orange box with text "koala species specification" because I used control= to made the input.

However, the system is asking for the exact input as Entity["Species", "Species:PhascolarctosCinereus"]

I believe they point to the same species datapage. The first try by control= is marked as incorrect (at least in my interface). Weird.

A similar issue happened for Ex17.6 When I used control= "2500yen", the nature language process returns Quantity[2500., "Yen"]

However, the checker wants Quantity[2500, "Yen"]


I do buy statements from Phil that redoing those exercises to explore the possibilities will enhance my memory and understanding of the Wolfram System. But at some moments, I found ex16.x is just not doable because of the nature language processing, I can do nothing about it.

I solved my problem about those syntax issues using with exercise solutions for 2nd-edition of the book. https://www.wolfram.com/language/elementary-introduction/2nd-ed/answers-to-exercises.html

Ex9.7 and Ex14.7 does not work, the solutions are wrong in the sense that the output is not the same as desired output (does not satisfy the question)

BTW, I encountered some errors simply due to the name of variables. It seems the checker prefers n in Table; i,j in 2-dimensional Table; x,y,z for coordinates; r for radius; theta for angle between (maybe) {0, 360 Degree}; x Degree for x between (maybe) {0,360};

or use the variables named by the question For Manipulate, click the + you can see the name of variable as the name of control bar

POSTED BY: Jingzhou Na
Posted 2 months ago

I believe your answer is one correct way, but the system does not have that in the solution checker. I tried

ToUpperCase[StringJoin[Alphabet[]]]

This one join everything as a single string "ab...z" and then capitalized the single string. {"a", "b", ..., "z"} -> "ab...z" -> "AB..Z" Your syntax gives the same result, it capitalized 26 alphabets and then join them into one single string. {"a", "b", ..., "z"} -> {"A", "B", ..., "Z"} -> "AB..Z"

For plenty of exercises, I do not think there is the best (or the simplest) answer. But seems the system does >_<.

Attachment

Attachments:
POSTED BY: Jingzhou Na
Posted 2 months ago

I'm not seeing the error - can you provide some direction?

enter image description here

POSTED BY: Patrick Brooks
Posted 2 months ago

I find this name confusing.

The Wolfram Language is a foreign language, and it's rather idiosyncratic. Some of the function names make perfect sense; some do not. The list of sensible function-names may even vary from person to person. The important thing is that we're able to find a function that we need at the time. When I need to look up a function, I search with google describing the function a bit. In this case:

wolfram documentation find which number matches a letter of the alphabet

We are fortunate that wolfram is a rather esoteric word in all languages; having that one word in searches will typically home in on the Wolfram Language. The first hit on the above search was the webpage for the FromLetterNumber function in the Wolfram Language and System Documentation Center. I also have great luck searching with ChatGPT. ChatGPT can do many marvelous things with the Wolfram Language. I have the free/limited account with ChatGPT, but one can do lots by carefully asking a few questions daily. It's kinda like a genie that gives you three wishes, but you get your wish-count renewed every single day.

POSTED BY: Phil Earnhardt
Posted 2 months ago

Thanks, Phil. Got it!

POSTED BY: John P Clark
Posted 2 months ago

Hi Rory, I have no idea how to insert images into the code. I tried copy and paste, and it doesn't work

Both Copy/Paste and Drag/Drop work just fine on my Mac. See attachment.

You can also use Import[] to import an image to the Wolfram Language App from the file system on your local machine or from a URL. Not Rory, but HTH.

Attachments:
POSTED BY: Phil Earnhardt
Posted 2 months ago

Hi Rory and Eryn, thank you for your time and support with the study group sessions and answers here.

Could you advise how to overcome the issues with system checks, like this one:

7.13 Use Part and RandomInteger to make a length-100 list in which each element is randomly a Red, Yellow or Green colorswatch.

I tried several options which give the expected outcome, but are deemed incorrect:

  • Part[{Red,Yellow,Green},RandomInteger[{1,3},100]]

  • Table[Part[{Red,Yellow,Green},RandomInteger[{1,3}]],100]

  • {Red,Yellow, Green}[[RandomInteger[{1,3},100]]]

  • Part[{RGBColor[1,0,0],RGBColor[0,1,0],RGBColor[1,1,0]},RandomInteger[{1,3},100]]

  • Table[Part[{RGBColor[1,0,0],RGBColor[0,1,0],RGBColor[1,1,0]},RandomInteger[{1,3}]],100]

There can be many other ways to get the expected outcome (including replacements inside the list of three colors), and it is tricky to guess what could be the idea behind the "correct" code.

I think it does not make sense to spend hours checking all the possible ways to solve the exercise. Are there some additional hints or solutions to such tricky exercises?

POSTED BY: Ilya Efimchuk
Posted 2 months ago

What is the ideology of the following name of a WL function:

FromLetterNumber

I find this name confusing.

POSTED BY: Artur R Piekosz

Hi there! You can access all the lectures and exercises in the course framework! Good luck :) https://www.wolfram.com/wolfram-u/courses/wolfram-language/an-elementary-introduction-to-the-wolfram-language/

POSTED BY: Rory Foulger
Posted 2 months ago

Hi Rory, I have no idea how to insert images into the code. I tried copy and paste, and it doesn't work. Apparently, I'm not familiar enough with the very basics of how to copy and paste in Mathematica. Please help.

POSTED BY: John P Clark

Hello Rory and Eryn, First, thank you for your time and support with the study group sessions.

I was wondering whether we could get downloadable lecture notebooks to pull up on our desktops to revise concepts and play around with the code to learn. It will also help us be prepared for the upcoming sessions.

Thanks, Ritish

Posted 2 months ago

Bugs with names of variables fixed in the answers, while this should be flexible

7.4 Make a list of colors with hues varying from 0 to 1 in steps of 0.1:

Table[Hue[h],{h,0,1,0.1}] - only with the variable name "h" the answer is accepted as correct

Table[Hue[x],{x,0,1,0.1}] - any other variable name is incorrect

7.8 Make a list of numbers from 0 to 1 in steps of 0.1, each with a hue equal to its value:

Table[Style[n,Hue[n]],{n,0,1,0.1}] - only with the variable name "n" the answer is accepted as correct

Table[Style[h,Hue[h]],{h,0,1,0.1}] - variable names "h", "x" or "a" are not accepted

:-(

POSTED BY: Ilya Efimchuk

Thanks! It is only recently that I learned about such things.

POSTED BY: Deuard Worthen

I agree. It seems like they're split into roughly 10 chapters each, so you should be able to do quiz 1 by the end of today's class.

POSTED BY: Rory Foulger
Posted 2 months ago

What is the intended answer?

The following questions score my answers as INCORRECT:

  1. Find the last five digits in 2^1000.

    IntegerDigits[2^1000][[-5;;]]

  2. Make a list of the letters at even-numbered positions in the alphabet.

    Alphabet[][[2;;26;;2]]

  3. Make a line plot of the second-to-last digit in the first 100 powers of 12.

    ListLinePlot[IntegerDigits[12^Range[100]][[All,-2]]]

  4. Join lists of the first 20 squares and cubes, and get the 10 smallest elements of the combined list.

    Take[Sort[Join[Range[20]^2,Range[20]^3]],10]

To the best of my knowledge, my answers are materially correct.

Do you have better answers?

POSTED BY: Artur R Piekosz
Posted 2 months ago

In the BigMarker video (I do not know any other videos) of Tuesday's second lecture in the course

The other videos are the ones in the EIWL framework itself -- 48 chapters of the book.

You're right. Eryn made a mistake working the exercise. Her answer was only fractionally correct.

POSTED BY: Phil Earnhardt
Posted 2 months ago

It would be helpful if the Quiz titles were labeled with section coverages (e.g., Quiz 1- EWL1 thru EWL8). I have no idea what sections any of the quizzes cover..

POSTED BY: John P Clark
Posted 2 months ago

I will try to give a correct reference:

In the BigMarker video (I do not know any other videos) of Tuesday's second lecture in the course @15:00 Eryn was discussing the exercise with a list of fractions. She did not erase the initial 1, while the question asked to start the list with 1/2.

POSTED BY: Artur R Piekosz
Posted 2 months ago

I do hope that the answers (all correct ones) and solutions are available once we finish each exercises.

In the past. exercise answers were available on the online book-editions of the course, and the book exercises are the same as the framework-exercises. I looked for them today; they appear to be gone. If you open up the exercise questions in the book-editions, you get kicked into a Wolfram Cloud place with the same grading engine. I'm pretty good at searching and poking around in archives; I couldn't find them anywhere.

More to the point: I can't think of a single thing I ever learned about the Wolfram Language by looking at those answers. Maybe there was an "Aha!", but I can't remember it.

Getting the right answer is missing the point. I'm not saying to not strive to answer the questions, just don't be obsessed with it. The EIWL framework is a dense course; you can wind up in the weeds if you obsess over getting every #!$$ answer right.

If you look at the Track My Progress link, you'll see a check-box for exercises. What percentage of exercises correct are required to get checked off on that section? I don't know, but I'm pretty sure it's not 100%. "Badges indicate graded exercises for certification." That's not enough information. @Rory: can you tell us what a passing grade is for the graded exercises in a section of the EIWL framework? Thanks.

Exercise 4.6 today is a good example where you should fight to figure it out. If you try

PieChart[{1,1,1,1,1,1,1,1,1,1}]

you'll get a NO PASS. That's correct, but a bad use of the tool. The designers wanted you to do something a bit more clever. Aha! Of course! I'm likely to remember that lesson now. :)

POSTED BY: Phil Earnhardt
Posted 2 months ago

THANK YOU, Phil.I will keep in mind your thoughtful advice.

See you around, Phil.

POSTED BY: Soomi Cheong
Posted 2 months ago

thank you for answering. However, I think that there was a misunderstanding because I did not write down.Too many wrong answers have taken too much of my time to post here (lol). I may be better not to in order to save my time.

Let me clarify my question. As the attached clearly shows, the question asks to compute 5 "squared" specifically. Thus, I thought that the answer should be 5^2 as you, Rory, mentioned. However, the problem is that the framework says that it is "IN-correct." Rather, the framework says that "5 x 5" is correct. Yes, outputs of both are the same. Thus, we can use any of them. However, for this particular question, the correct answer should be "5^2," right?

Hmm... too many errors..

BTW: THANK YOU for answering, not ignoring. It means a lot! Arben, Luke, Eun Hyun, and Mike never ignore my question, no matter what it is: I sometimes ask the answer to a poll question. Instructors except Luke mention the answers verbally only. Sometimes it happens so fast. Or, I was following something that the instructor mentioned before.

I remember that the director at Machine Learning department during Arben's ChatGPT daily study group messaged me back with the correct answer and the reason why it was the correct answer (this was exactly what i was looking for) - I always am interested in the rationale (why???!!!).

THANK YOU, Rory! Hopefully, this post can clear my question.I don't understand why the errors occur: again, too many errors.

POSTED BY: Soomi Cheong
Posted 2 months ago

Thanks, Soomi. There are plenty of superior Wolframers (is that a word?); they're just not around this course. Our course instructors are far more qualified. Cassidy is pretty darn qualified too, but she rarely shows her technical chops in courses.

I do hope that the answers (all correct ones) and solutions are available once we finish each exercises.

I understand the sentiment, but I strongly disagree. The goal is to learn, which may not mean getting the right answer. Be tenacious in seeking the expected result, but don't drown in frustration if you can't find it. Sometimes, there's some point to the exercise that may not be obvious on the first (or fifth) try. In those cases, seek to outflank the problem. Look up the official documentation describing the function. You may find the solution there. You may learn something that helps your overall Wolfram knowledge but has nothing to do with the exercise. That's all part of the game. I remember being extremely frustrated when I ran through [most of] the interactive course; I actually abandoned getting the cert.

When you have some time, I recommend checking out Conrad Wolfram's 2010 TED Talk. He's commenting on the fallacious way we teach math in school. It's not about getting the right answer; it's about knowing how to think and learn in a particular system. This course is a bit different: we're learning the [arbitrary] framework of the Wolfram Language; all of its idiosyncrasies. The goal of the exercises is to learn the language: listening/reading and then speaking/writing. Try like heck to get the exercises right, but realize that that's never the goal. And -- please -- have fun in the process. Respect the exercise framework, but have a healthy lack of respect for it, too.

POSTED BY: Phil Earnhardt

You'd need to plot the numbers

1, 2, 3... 100, 99, 98... 3, 2, 1

Your first answer plots the numbers

1, 2, 3... 100, 100, 99, 98... 3, 2, 1

POSTED BY: Rory Foulger

It's asking you specifically to use power, so multiplication will be incorrect, as you haven't answered the question, even though the output is the same :)

POSTED BY: Rory Foulger

Agreed - that solution would be marked as incorrect. I was demonstrating other skills :)

POSTED BY: Rory Foulger
Posted 2 months ago

The solution in the video recording is wrong. You have got 4. But 4<10.

If you're going to reference a video, please say which exact video you're discussing and provide a timestamp. It looks like you're talking about the BigMarker video of Monday's first lecture in the course @38:05. Rory was discussing the exercise with RandomInteger[]. He showed:

Plus[RandomInteger[{1,10}],RandomInteger[{1,10}]]

and ran that computation several times. One of those results was 4. I'm certain the grading engine would score his expression above as wrong. I don't think Rory was trying to solve the exercise; he was showing an expression close to what was asked in the exercise. You're right: his language may have been a bit ambiguous.

POSTED BY: Phil Earnhardt
Posted 2 months ago

Rather this:

10+RandomInteger[10]

The solution in the video recording is wrong. You have got 4. But 4<10.

POSTED BY: Artur R Piekosz
Posted 2 months ago

Dear Soomi,

You should use your own intelligence and predict the intended answer. Then, code the answer using WL. Do not expect too much from algorithms. Your answers were not real simplifications. Only if we have one list in one piece, then we can be happy with the simplification. I see that some versions of codes giving {1,2,3,4,5} are possible.

POSTED BY: Artur R Piekosz
Posted 2 months ago

Rory,

Your solution to this question was also the same as mine, as attached.

->

Then, you solved it wrong?

->

Which one is correct?

Attachment

Attachments:
POSTED BY: Soomi Cheong
Posted 2 months ago

@Rory/@Eryn , there's a problem displaying plots when running Wolfram Cloud on an iMac (24-inch M1 2021, macOS 14.6.1, Safari 17.6): tic marks are not scaled correctly. This shows up in the EIWL course framework. For example, Exercise 3.6 looks like this on that hardware/software:

enter image description here

I reported this bug to Wolfram Technical Support (CASE:5170014) back at the end of August. I think I went through all the steps, but I have no sense how long it takes to fix a bug in the cloud environment. They asked me for the $CloudVersion which has the bug; it's now 1.69.0.1 (September 4, 2024).

The problem doesn't happen in the Google Chrome browser on the iMac. I will switch to Chrome. This is a FYI if other students encounter this on an iMac. If you have access to look up the bug report internally, I'd be grateful if you'd see if they're waiting for me to do something.

POSTED BY: Phil Earnhardt
Posted 2 months ago

Where do I find the course framework and exercises? Link(s)? Never mind... got it!

POSTED BY: John P Clark
Posted 2 months ago

Thank you for the pep talk, Phil - you are the smartest and the best Wolfram learner, as I have observed. I really appreciate it. I do hope that the answers (all correct ones) and solutions are available once we finish each exercises.

POSTED BY: Soomi Cheong
Posted 2 months ago

THANK YOU! I thought that we needed to find out the simplest way to make {{1,2},{3,4},{5}} into {1,2,3,4,5}.

-> I understand it now.

Attachment

Attachments:
POSTED BY: Soomi Cheong
Posted 2 months ago

Yes. The engine tries hard, but it doesn't always get it right. When the examples get more complex, the engine gets far more interesting. I'd love to have a peek under the hood.

You've gotten right answers shown as wrong by the grading-engine. The real challenge is to submit a wrong answer and have the engine judge it as right. Game on, @Soomi

POSTED BY: Phil Earnhardt
Posted 2 months ago

I misunderstood the question? I thought that Exercise 3.6 asks me to plot a list from 1 to 100 and then from 100 to 1. -> Based on your answer (THANK YOU!), I solved it like the below attached. However, it is not correct. I tried tot use "Plot". However, it wouldn't work. As I know, "ListPlot" is the only way to plot it. -> Did i get it wrong again?

Attachment

Attachments:
POSTED BY: Soomi Cheong
Posted 2 months ago

Exercise 1.4 Compute 5 squared (i.e. 5x5 or 5 raised to the power 2)

->

(My solution)

5x5

5^2

->

the framework says only 5x5 is correct.

->

both of them are correct answers, right? (Hmm... too many wrong answers..)

Attachment

Attachments:
POSTED BY: Soomi Cheong

The problem with the framework is that it will only really take the answer it's expecting to get. The simplest form of this question is Range[5], which is the correct answer. I agree that the question isn't super clear that it's wanting you to actually rewrite the code, rather than simplify the current code.

I believe in you! Keep on double-checking your answers and exploring new ways to get to the solution when your first thought doesn't work.

POSTED BY: Rory Foulger
Posted 2 months ago

Exercise 3.9

Find a simpler form for Join[{1,2},Join[{3,4},{5}]]

-> (My solution)

Join[{1,2},{3,4},{5}]

->

My solution is correct. However, the framework says that it is not.

->

What is the answer? (not again..)

Attachment

Attachments:
POSTED BY: Soomi Cheong

Heya! For this one, your answer isn't quite correct. It's asking for a list going up to 100 and then back down to 1, and you have 100 twice. See if you can use Range to stop the repeated number, and then it should be correct.

POSTED BY: Rory Foulger
Posted 2 months ago

Exercise 3.6 Plot a list that counts up from 1 to 100, then down to 1.

->

(My solution)

As attached,

ListPlot[Join[Range[100],Reverse[Range[100]]]]

->

However, the framework says that it is not correct.

->

Then, what is the correct answer??? And, why???

  • Rory, it seems like that many exercise answers are not correct (lol). -> Should I post each of them whenever I find them?
Attachment

Attachments:
POSTED BY: Soomi Cheong

You can also use the scratch notebook within the framework!

POSTED BY: Rory Foulger

Hi! It looks like there's a resource function that does what you're looking for here.

An easy way to use a resource function is to hover over the title of the function on the webpage so you get the click-to-copy UI, then click on the copy button and paste it into your notebook.

POSTED BY: Rory Foulger

It's a shame the framework doesn't take your RandomInteger[{0,1000}] solution, that seems reasonable to me. But I imagine that the designers want you to use the simplest iteration of the code, which would be RandomInteger[1000], as it's unnecessary to specify that you want between 0 and 1000, as the default minimum is 0.

POSTED BY: Rory Foulger

I think a good answer would probably be the easiest (in class, I was aiming to show a more complex solution)

Plus[10, RandomInteger[{1,10}]

POSTED BY: Rory Foulger
Posted 2 months ago

Exercise 2.4 Use RandomInteger to geneerate a random integer between 0 and 1000.

(Your solution)

RandomInteger[1000]

-> However, based on the definition of RandomInteger and Wolfram Documentation (https://reference.wolfram.com/language/ref/RandomInteger.html),

There are two answers: (My Solution)

RandomInteger[1000]

RandomInteger[{0, 1000}]

  • what do you think?
Attachment

Attachments:
POSTED BY: Soomi Cheong
Posted 2 months ago

Exercise 2.5 Use Plus and RandomInteger to generate a random integer between 10 and 20.

-> (Your solution)

RandomInteger[{1,10}] -> generates a random number between 1 and 10

Then,

Plus[RandomInteger[{1,10}, RandomInteger[{1,10}] -> generates a random number between 2 and 20, not between 10 and 20

(My solution)

RandomInteger[{5,10}] -> generates a random number between 5 and 10

Thus,

Plus[RandomInteger[{5,10}, RandomInteger[{5,10}] -> generates a random number between 10 and 20

  • What do you think?

  • I tried your solution to doublecheck my idea. Then, the output is between 2 and 20, as attached.

->

The framework also says that it is not correct.

->

Then,

what is the correct answer???

Attachment

Attachments:
POSTED BY: Soomi Cheong

How would you define a function for tetration (next operation after exponentiation - spell checker really wants titration)? Or something more general to continue the operations to higher values. This easily produces exceptionally large numbers which can quickly exceed a computer's capacity.

POSTED BY: Deuard Worthen
Posted 2 months ago

One other recommendation you may want to announce to the class: if you download directly the notebooks for EIWL, you can "read along". Those notebooks will play in the Wolfram Language App. They will also download and play them in the Wolfram Player.

The notebooks for this course are pretty big: 250MB.

POSTED BY: Phil Earnhardt

Hi Phil! We're glad you like the system, and I completely agree! Big fan of code fragments rather than multiple choice. Yes, we'll be doing the exercises as part of the Daily Study Group this session. Looking forward to seeing you there!

POSTED BY: Rory Foulger
Posted 2 months ago

I love the exercise grading engine for the EIWL interactive course. Submitting code fragments is so much better than multiple-choice questions. Will we be doing the exercises from there in this course?

POSTED BY: Phil Earnhardt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract