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

The correct answer to Problem 6 in this quiz seems incorrect to me, or at least the wording in the answers is quite ambiguous. Without giving away the answer, consider

Module[{x}, x]
POSTED BY: Rohit Namjoshi
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

Hi Michael, No you do not have to submit again if you have already completed the 6 quizzes from the "Intro to Notebooks" course. You will receive your certificate of completion associated with the course "Introduction to Notebooks".

We are also offering a "Certificate of Program Completion" specifically for the Study Group "Going Further with Notebooks" that we completed last week. For that certification we are requesting that you complete the quiz that was shared with all study group attendees on the last day (Nov 5, 2021) of the study group.

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 :)

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

By playing with a screen image I pasted into a text cell in Mathematica, I found out how to interactively modify the image. When I double click the image a pop-up menu appears below the image that enables me to interactively modify the image.

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

Perhaps something more general:

  • Automated Wolfram Notebook Authoring
  • Automated Wolfram Notebook Creation
  • Programmatically create Wolfram Notebooks
POSTED BY: Daniel Carvalho

Awsome! Thank you.

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

Very helpful, thank you!

POSTED BY: Heidi Liu
Posted 4 years ago

From Gurbax Singh I have noticed the following two points: 1. To get the item bullet (the red little square), you can tap Shift+8/, it may give you the bullet or the star as it is supposed to do. However, if your cursor is blinking on the insertion bar and then you tap Shift+8/, you will get the beautiful red bullet every time.

  1. You can insert a different bullet as follows: go to Format->CellDingbat->a popup menu of 28 bullets to choose from shows - square (filled/empty), circle (filled/empty), wolf, diamond, and others. However, they are in black/white.

Question: How can you style it - change its color, etc.

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

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

Dave also suggests setting the "Alignment" option to the character "=". Mentioned under "Details" on https://reference.wolfram.com/language/ref/Alignment.html: "c" aligned on the specified character in a grid

    Grid[{
          {x == y1 + y2 + y3}, 
          {a + b + c + d + e == 0}, 
          {1 ==  p + q + r + t + y}}, 
           Alignment -> "\[Equal]"]
Posted 4 years ago
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.

POSTED BY: John Burgers
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 :(

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

Thanks for the challenge Abrita,

Here is my interpretation of that image,

Grid[Table[Style["x", Bold, FontSize -> 30], {5}, {7}], 
 Background -> {None, {{Green, Yellow}}, {{2, 3} -> Red, {2, 5} -> 
     Orange, {4, 3} -> Purple, {4, 5} -> Magenta}}, 
 Spacings -> {1, 1}]
POSTED BY: John Burgers
Posted 4 years ago
POSTED BY: Luis Phillips
Posted 4 years ago

@John Burgers @Luis Phillips

Abrita's letters are somehow dark blue for me - that's why I used a slightly darker blue. What do you think: does the color match the task?

I also placed a narrow vertical black line on the right side, which can be easily overlooked ;-)

It seems to me that the letters are also aligned left, center and right. Is that deceptive? The vertical alignment is also variable line by line, isn't it? [For that I also have a solution. Luis, you wanted to play a bit with the style and I don't want to take the fun away from you. Therefore I do not post the corresponding code lines yet... Have fun!]

Grid[
 Table[Style["x", Darker@Blue, Bold, 14], {5}, {7}],
 Background -> {{}, {{Green, Yellow}}, {{2, 3} -> Red, {4, 3} -> 
     Purple, {2, 5} -> Orange, {4, 5} -> Magenta}
   },
 Dividers -> {-1 -> True}
 ]
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

Hello John, this is my solution.

If you analyze my result, you will find some differences to Abrita's problem. For example, the divider on the right side does not have the correct thickness.

Grid[
 Table[
  Style["x", RGBColor[{42, 63, 140}/255.], Bold,
   12], {5}, {7}],
 Background -> {
   {},
   {{Green, Yellow}},
   {
    {2, 3} -> Red,
    {4, 3} -> Purple,
    {2, 5} -> Orange,
    {4, 5} -> Magenta
    }
   },
 Dividers -> {-1 -> Black},
 Spacings -> {
   {0, .5, .5, .5, .5, .5, .5, 0},
   {0, .2, .3, .3, .3, .2}
   }
 ]

By the way - I tried to identify the spacings with this:

Manipulate[
 Grid[
  Table[
   Style["x", RGBColor[{42, 63, 140}/255.], Bold,
    12], {5}, {7}],
  Background -> {{},
    {{Green, Yellow}},
    {
     {2, 3} -> Red,
     {4, 3} -> Purple,
     {2, 5} -> Orange,
     {4, 5} -> Magenta
     }
    },
  Dividers -> {-1 -> Black},
  Spacings -> {
    {h1, h2, h3, h4, h5, h6, h7, h8},
    {v1, v2, v3, v4, v5, v6}
    }
  ],
 "horizontal spaces",
 {{h1, 0}, -1, 4}, {{h2, 0}, -1, 4}, {{h3, 0}, -1, 4}, {{h4, 0}, -1, 
  4}, {{h5, 0}, -1, 4}, {{h6, 0}, -1, 4}, {{h7, 0}, -1, 
  4}, {{h8, 0}, -1, 4},
 Delimiter,
 "vertical spaces",
 {{v1, 0}, -1, 4}, {{v2, 0}, -1, 4}, {{v3, 0}, -1, 4}, {{v4, 0}, -1, 
  4}, {{v5, 0}, -1, 4}, {{v6, 0}, -1, 4}]

It turns out that h8 works, but h1, v1 and v6 do not. It seems that the spacings "before"/"after" an entries only have an effect if there is something before or after - like the delimiter after the last column (h8).

I used the coordinate tool to find the RGB values of the letters - see attached picture.

@Abrita: Could you also tell us what WL commands you used to create the image?

Attachment

Attachments:
POSTED BY: lara wag

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

How do I remove a palette from the Palettes menu? I removed the palette's .nb file from folder "C:\Program Files\Wolfram Research\Mathematica\12.3\SystemFiles\FrontEnd\Palettes", but the palette still appears in the Palettes menu. Also, I installed a palette but when I select it from the Palettes menu, the source .nb file appears and I explicitly have to run that file to get the palette to appear. I did use Cell > Cell Properties, to set the cell that generates the actual palette to be an Initialization Cell.

POSTED BY: Gerald Dorfman

Hi Gerald, sometimes a restart of Mathematica is required to remove a palette. Also two other places you should check for palette-related notebooks are the Applications folder in BaseDirectory and UserBaseDirectory. If you find files related to your palette in those folders, delete them and restart Mathematica.

To finalize, save and install the palette on your system, could you try the instructions in this tutorial? Let us know if you continue to face issues with using the installed palette.

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 need to set the "ShowSyntaxStyles" option to True. For example:

SetOptions[EvaluationNotebook[],PrintingStyleEnvironment -> "Printout", ShowSyntaxStyles -> True]
Export[FileNameJoin[{NotebookDirectory[], "ShowSyntaxStylesPrintout.pdf"}], EvaluationNotebook[]];
SystemOpen[%]

Attached is an example notebook and the corresponding PDF.

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
POSTED BY: Steven Zimmerman
Posted 5 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 5 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 :)

  1. How can I find your saved response to my inquiry in the class?
  2. How do I get a temporary online account? I planned using my home Mathematica, but realized that links to the files in the NB version of a lesson point to the files stored in the cloud.

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.

Posted 4 years ago

One thing I appreciate about the notebook interface in recent years that might seem trivial to new users is the quick option to "Convert to Text Cell". As someone who has typed a lot of text cells -- while too frequently forgetting to type the Alt+7 shortcut first -- I know the new shortcut has saved me a lot of time since its implementation. There are a lot of little improvements like that that make Mathematica the most usable software system I've ever used.

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