Group Abstract Group Abstract

Message Boards Message Boards

[WSG21] Daily Study Groups featuring Notebooks: Intro and Going Further

On October 18th we will begin our next Daily Study Group series that will focus on "Notebooks". As a cohort of online learners we will work through the Wolfram U interactive course "Introduction to Notebooks" in short sessions hosted by Wolfram-certified instructors, that will feature live Q&A, review exercises, and additional examples on topics covered in the course. This study group will help you achieve the "Course Completion" certificate for the "Introduction to Notebooks" course after you complete the course quizzes.

We will follow up the two weeks of the "Introduction to Notebooks" study group with a week-long study group on "Going Further with Notebooks" which will feature additional material that builds on the introductory course. A certificate of program completion will be available for this series as well.

Please sign up here:

We will continue discussion on the topics covered in these study groups on this thread. Looking forward to the questions and shared ideas about using notebooks.

85 Replies

Requesting our study group attendees to kindly refrain from sharing any links emailed to you (notebooks/videos/quizzes) here on the public forum. Thank you.

Posted 4 years ago
POSTED BY: Rohit Namjoshi

Let me add the following to the question "Using the Module command causes the variable to:"--the "variable" refers to the local variable declared in the Module.

Your options are:

  • (A) The local variable will be assigned a new, random value each time the program is run
  • (B) The local variable will be evaluated again every time any cell in the notebook is evaluated
  • (C) The local variable will be removed from the system after the program (Module) is finished evaluating
  • (D) Both A and B
  • (E) Both B and C
Posted 4 years ago

How soon do we have to submit the solution to the quiz - Going Further with Notebooks? Gurbax Singh

POSTED BY: Gurbax Singh

The deadline for the quizzes for both "Introduction to Notebooks" and "Going Further with Notebooks" is Nov 19, 2021.

Hi. I submitted all my quizzes for the previous NB class on time.
Do I have to submit them again?

I rechecked it: there are 6 quizzes; all are accepted.
Please, comment. Thanks. M

Posted 4 years ago

That's very nice. If the question is really "when", then perhaps Print[Now] instead of Print[MousePosition["Graphics"]]?

POSTED BY: Rongoetz
Posted 4 years ago
POSTED BY: Rongoetz

Thank you, rongoetz. Very helpful. M

Posted 4 years ago

Hi Michael, do you mean what is shown in the attachment? (To local reference you need to write the word "paclet:" in front of the link on the reference)

Attachment

POSTED BY: lara wag

Great! Thank you very much, Lara. M

And it's a good breathing exercise :)

Thank you, Abrita. You are saying that this is not recommended. But is it possible? Sure, it does not work directly and blocks evaluation. But can we hack it? May be with some version of Hold or anything that prevents evaluation at some step/level. Any advice would be appreciated. M

I was playing with hyperlinks. Consider the following function pointing to a tagged cell in another NB:

Hyperlink[
 Framed[Style["About Hyperlink", FontColor -> LightYellow, 
   FontWeight -> "Heavy", FontSize -> 18], Background -> Blue, 
  FrameStyle -> {Thickness[3], 
    Orange}], {"D:\\aWolfram_Classes\\Going Further \
with Notebooks\\Day 3\\ProgrammingWithControls.nb", "Hyperlink"}]

It works fine. However, I would like the symbol "Framed" to be hyperlinked (right from the body of the function) to "https://reference.wolfram.com/language/ref/Framed.html". How can it be done without interference with the evaluation of the Hyperlink[] function? PS The question is general, could be related to any code.

Hi Michael, If you use the Hyperlink Head on the symbol Framed, it will change the expression into

Hyperlink[Framed, "http://reference.wolfram.com/language/ref/Framed.html"]

This expression has a Head "Hyperlink" now. It cannot work as the symbol Framed anymore.

We do not recommend creating hyperlinks from parts of your code itself. Rather Hyperlink is better used to create buttons or links from pieces text and strings.

Posted 4 years ago
POSTED BY: Rongoetz

Hi Ron, The shortcut Ctrl+8 or Ctrl+* is currently assigned to convert an "Input" style cell with Wolfram Language code into an Initialization cell. You will notice it listed as the shortcut key next to Cell -> Cell Properties -> Initialization cell menu item.

I will forward a report to the development team about the text in the documentation at https://reference.wolfram.com/language/tutorial/ManipulatingNotebooks.html that is causing confusion.

"Ctrl+* or Ctrl+8 (between existing cells) put up a dialog box to allow input of a cell in Wolfram Language expression form"

While on the topic of shortcut keys, it should be possible to edit the KeyEventTranslations.tr or MenuSetup.tr file (found at $InstallationDirectory/SystemFiles/FrontEnd/TextResources/<OS>/) to customize your shortcut keys and add new ones. Also, as per the post here another long-term Wolfram user @Rolf Mertig has created a package Shortcuts to allow you to customize shortcuts.

Posted 4 years ago

Thanks, Abrita. I did notice the shortcut for toggling a cell but only after I had posted the question.

Is there another way to get the described dialog box for entering a cell expression as described in the tutorial?

Ron

POSTED BY: Rongoetz
Posted 4 years ago

Got it. Thanks, Abrita.

POSTED BY: Rongoetz
Posted 4 years ago
POSTED BY: Gerald Dorfman

Right, we can use the Image Assistant toolbar as explained in the documentation for Predictive Interface

enter image description here

Posted 4 years ago
POSTED BY: Gerald Dorfman
POSTED BY: Daniel Carvalho

Cool examples Daniel. Thanks for sharing.

Thank you, Daniel. M

Daniel, could you please advise what would be an appropriate name for my Roam page with this type of entries? How about "Creating Wolfram notebooks from (?) various data sources"? Thanks. M

POSTED BY: Daniel Carvalho

Awsome! Thank you.

Posted 4 years ago

What information do the cell brackets convey? It appears to me that the two lines atop signify text, the open triangle an input cell, the open triangle with a line an output cell (?), and a small x with a line below? I find these visual cues helpful. Could you please mention the correct meaning for the ones I mention above, and any others I might have missed? Thank you!

POSTED BY: Heidi Liu
Posted 4 years ago

Very helpful, thank you!

POSTED BY: Heidi Liu
Posted 4 years ago
POSTED BY: Gurbax Singh
Posted 4 years ago

Abrita Chakarvarty, John Burgers, Michael Partensky How about this simple-minded way which produces the same output:

Grid[Table[10 i + j, {i, 4}, {j, 8}], Frame -> All, 
 Background -> {{}, {}, {{2, 5} -> Orange}}]

From Gurbax Singh

POSTED BY: Updating Name

Very impressive, Gurbax. So far you are apparently the winner! Please accept my congrats (subject to other participants' approval) !

PS: Using @#&_/ would give an extra bonus :)

Posted 4 years ago
POSTED BY: Dave McCollum
Posted 4 years ago

Abrita wrote:

To align equations on the "=" sign you can use from the palette Writing Assistant -> Math Cells -> Equal Symbol Aligned Math Cell.

Aha. Thanks! I thought that there should be some way to align cells using the interactive math palettes/features but couldn't find it...

POSTED BY: Dave McCollum

Sorry for my confusion with the functions related to opening notebooks on your system. Hope the following clears it up a bit:

  • NotebookOpen opens an existing notebook with the specified name, returning the corresponding notebook object. You need to provide the complete path to the notebook file.

    nb = NotebookOpen[FileNameJoin[{Directory[], "document.nb"}]];
    

nb will now represent the notebook object and can be used further (for example by commands like NotebookSave and NotebookClose)

  • NotebookGet gets the raw expression corresponding to the notebook represented by the notebook object obj.

    nb = NotebookPut[
       Notebook[{Cell["Subsection heading", "Subsection"], 
         Cell["Some text.", "Text"]}]];
    NotebookGet[nb]
    

enter image description here

POSTED BY: John Burgers

Right, if we close a programmatically created notebook without saving it, we will not be able to get back the Notebook object.

Hi Michael, Ah, you've posted yourself to a mental challenge !! The code is concise, and still readable. You did it!! I would not go any further. John

POSTED BY: John Burgers

Thanks, John. Just trying to build a bridge between the current and previous classes. The #s, @s and &s already require refreshment! :) Best. M

Posted 4 years ago

If you want more # @ //.... :-)

g = Grid[#, Frame -> All, Background -> {{}, {}, {{2, 5} -> Orange}}] &;
t = Range[10 # + 1, 10 # + 8] & /@ Range@4;
t // g
POSTED BY: Rohit Namjoshi

Awesome, Rohit! In my view, Range mapping Range is really out of box! And it's very nicely compartmentalized, with elegant "post-processing" (can I put it this way?) . Thank you!

Hats off to you Rohit. Agree with Michael that's awesome. Thanks!

POSTED BY: John Burgers

Certainly, this is more concise :

Grid[Table[Range[10 i + 1,  10 i + 8], {i, 1, 4}], Frame -> All, 
 Background -> {{}, {}, {{2, 5} -> Orange}}]

Can you beat it? :)

Sorry, I know that it is not exactly on the topic :(

Good Job, John. I also have a question (not a challenge though, - just curious).
Consider the example from NB09TablesFinal.nb:

Grid[{{11, 12, 13, 14, 15, 16, 17, 18},
  {21, 22, 23, 24, 25, 26, 27, 28},
  {31, 32, 33, 34, 35, 36, 37, 38},
  {41, 42, 43, 44, 45, 46, 47, 48}}, Frame -> All,
 Background -> {{}, {}, {{2, 5} -> Orange}}]

This makes the code shorter:

Grid[Range[#[[1]], #[[2]]] & /@ 
  Table[{10i + 1, 10i + 8}, {i, 1, 4}], Frame -> All, 
 Background -> {{}, {}, {{2, 5} -> Orange}}];

What are the better ways?

Fun challenge for the day: Post the code to create the following Grid enter image description here

Colors used: Yellow, Green, Red, Orange, Purple, Magenta

POSTED BY: John Burgers
Posted 4 years ago
POSTED BY: Luis Phillips
Posted 4 years ago
POSTED BY: lara wag

Hello Iara, Your very observant, much more than I. So I defer to your solution. the darker line initially did catch my eye as odd, so I omitted it. Would love to see how you transitioned the vertical spacing, you may be correct that x's in the top row are raised somewhat, still I think the vertical alignment is Center on all the remaining rows. I'm guessing that your absorbing a lot from this course just by being so attentive !! Best Wishes. John.

POSTED BY: John Burgers
Posted 4 years ago
Attachment

Attachments:
POSTED BY: lara wag

Hi, Abrita. Where can I find a reading assignment for this week? I downloaded a bunch of NB files, without any guidance. In which order are they to be read, processed? Is there also a video to watch? Thank you. M

Just found the video, but it was suddenly interrupted by the announcement of the forthcoming session. Is there a YouTube version? Thanks.

Hi Michael,

There are no reading assignments. We are only requesting the attendees to watch the video for the day. The video is available on the BigMarker session page for the day (and are also linked from the reminder emails). The notebooks are meant to be supplemental material to help you with the video lessons.

The topics to be covered each day are listed on the study group registration page: https://www.bigmarker.com/series/daily-study-group-going-further-with-notebooks/series

Hello Abrita and team,

Please ignore. This problem was resolved by a computer restart.

For sure this question is not part of this course, I hope you can address it.

While testing some concepts, and I don't know why, all of a sudden all Mathematica window titles have jumped to a larger font, including the Mathematica desktop launch screen and, files, pallets, the option inspector window ... which I open of which I'll try to attach a screen shot of the launch screen. Stopping / restarting Mathematica was no remedy.

I didn't attempt to do this, nor did I make any adjustments to the option inspector. Do you have any idea how this could be done, ie inadvertent key combination??

Any help would be appreciated to get back to a normal Mathematica window title font size.

Thanks, John Burgers.

Attachment

Attachments:
POSTED BY: John Burgers

Thanks for sharing John. Another helpful hammer for the reasonably smaller nails :) is the "clean start" as explained here: https://support.wolfram.com/12464

Posted 4 years ago
POSTED BY: Gerald Dorfman

Interactive Wordcloud

Getting two columns in a notebook

The notebook does not support content in two columns automatically. But you can create a Grid to get it in two columns. Try:

{col1, col2} = 
  StringTakeDrop[ExampleData[{"Text", "DeclarationOfIndependence"}], 
   4500 - 42];
Grid[{{col1, col2}}]

or

Grid[{Style[#, FontFamily -> "Times"] & /@ {col1, col2}}]

Resource of the day: A great video class explaining the Manipulate function: https://www.wolfram.com/wolfram-u/catalog/gen702/

Is there a way to maintain the syntax coloring in PDF or any other exports?

POSTED BY: James Choi

You found it! Thank you!

I don't mean to sound greedy but is there an option I can set to preserve the syntax coloring when I copy and paste the Wolfram Language statements?

Thank you!

POSTED BY: James Choi

Thank you!

POSTED BY: Steven Zimmerman

A nice post on community about a custom stylesheet: https://community.wolfram.com/groups/-/m/t/2018326

Posted 4 years ago

Are the videos we're viewing in the class sessions available online, other than in the meeting recording?

POSTED BY: Wissam Barakat
Posted 4 years ago

Question of the day: What is one notebook feature that you have found especially useful in your work?

I enjoy the feature that allow inserting code from other programming languages into the notebook. Additionally, the ability to convert notebook cells into LaTeX or the feature that allows inserting inline LaTeX expressions into cells have made mathematical typesetting quick and easy.

As of version 12.3, using the drawing tools is much easier than the previous versions.

POSTED BY: Steven Zimmerman

Folding and unfolding the groups of cells :)

Hi Michael, Here are the two links I shared with you during the session:

Also we will upload a weekly digest of all the Q&A transcripts from this week. That should be a helpful resource since we received a lot of great questions during the study group sessions.

You can sign up for the Wolfram One trial subscription at https://account.wolfram.com/access/wolfram-one/trial or Mathematica trial at https://www.wolfram.com/mathematica/trial/

Feel free to email info@wolfram.com if you run into any issues with the trial versions.

Thank you, Abrita. Sorry I did not see it before.

Posted 4 years ago
POSTED BY: Rongoetz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard