Group Abstract Group Abstract

Message Boards Message Boards

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

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

Yes, Abrita. I did complete the last Quiz (one with 10 questions (?)). Thank you. I enjoyed the class. Its Highlight was the presentation on bridges. This can explain to many why the Wolfram language is so valuable not only in special applications, but also in everyday life... And there was also many important technical insights and details. Overall, those five meetings were condensed and instructive. My great thanks to the whole team! Looking forward to the class on difEqs. Some emphasis on the nonlinear dynamics would be appreciated.

Michael.

Question from Tom Milac:

I'm trying to identify when I have clicked on the Text "A" displayed on the code below. I assume the light blue background for the character represents the real estate `owned' to by the "A". I'm trying to understand a way - or the best way - to decide when I have clicked on the "A", i.e., the blue background area.

DynamicModule[{}, 
    EventHandler[ 
        MouseAppearance[ 
            Framed[ 
                Pane[ 
                    Graphics[ 
                        {Circle[{0, 0}, 10], 
                        Text[Style["A", FontSize -> Scaled[0.1]], {0, 0}, Background -> LightBlue] }, 
                    PlotRange -> {{-50, 50}, {-50, 50}} ] 
                ], 
                FrameMargins -> 0, 
                ImageMargins -> 0 
               ], 
            "Arrow" ], 
            {"MouseClicked" :> Print[MousePosition["Graphics"]]}]]

My suggestion would be to wrap the EventHandler around the smallest object on which you would like to detect the mouse click.

DynamicModule[{},
 MouseAppearance[
  Framed[
   Pane[
    Graphics[
     {Circle[{0, 0}, 10],
      EventHandler[
       Text[Style["A", FontSize -> Scaled[0.1]], {0, 0}, 
        Background -> LightBlue],
       {"MouseClicked" :> Print[MousePosition["Graphics"]]}
       ]
      },
     PlotRange -> {{-50, 50}, {-50, 50}}]],
   FrameMargins -> 0,
   ImageMargins -> 0],
  "Arrow"]
 ]
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

Michael, Yes, you have to precede your reference with "paclet:" to get a hyperlink to the local help system. See the documentation for Hyperlink: Hyperlink["hyperlink", "paclet:ref/Hyperlink"].

To get a URL for the web documentation, you can click on the dropdown list next to "URL" in the upper right corner of a help page and click "Copy web URL", getting, on the Hyperlink page, for example: http://reference.wolfram.com/language/ref/Hyperlink.html

POSTED BY: Rongoetz

Thank you, rongoetz. Very helpful. M

Posted 4 years ago
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.

Posted 4 years ago

I've been going through the Manipulating Notebooks tutorial (tutorial/ManipulatingNotebooks#31306) and in the very beginning it says that the keyboard shortcut Ctrl+8 can be used to "put up a dialog box to allow input of a cell in Wolfram Language expression form". My system does not respond to this keyboard shortcut. Do I need to change a setting in the Preferences dialog or ...?

Thanks.

POSTED BY: Rongoetz
Posted 4 years ago
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
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

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

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

If I recall correctly, in today's session someone asked about formatting typeset equations over multiple lines, where each line is aligned to the equals sign.

I tried looking for clear answers for a while and couldn't find anything that would apply to DisplayFormula or DisplayFormulaNumbered cells, assuming the goal is to just include typeset math in a notebook (and not just "computable" Input).

A first try was using an Input cell of the form:

enter image description here

where the two equations are entered via inline TeX input (control-4 on macOS). Of course, the result isn't just typeset math as text.

I did find a workaround by creating a DisplayFormula or DisplayFormulaNumbered cell, then using the math notation palettes or keyboard shortcuts to create a one-column, multiline "matrix/array" (without delimiters). I then entered one equation per line. For each equation, I positioned the cursor to just before the equals sign and entered "escape-a-m-escape" to enter alignment markers. After that, I showed the cell expression (shift-command-e on macOS) and modified the GridBoxAlignment option to "=", as shown below. This resulted in the numbered equation (2) shown in the screenshot image below.

enter image description here Note: I duplicated the DisplayFormulaNumbered cell to include both views in the image above.

I would imagine that there's a much better way to do this type of multiline typesetting. So, I offer my less-than-great attempt in the hope that someone else has figured out a more elegant solution or may gain some inspiration to do so.

Cheers,

Dave

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

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

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

POSTED BY: John Burgers

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?

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

Just the grid colors:

Grid[Table[X, {5}, {7}], 
 Background -> {{}, {{Green, Yellow}}, {{2, 3} -> Red, {4, 3} -> 
     Purple, {2, 5} -> Orange, {4, 5} -> Magenta}}]

I will review the style later :D

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

Attachment

Attachments:
POSTED BY: John Burgers
Posted 4 years ago
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

POSTED BY: James Choi

Hi James, Thanks for an excellent question. Unfortunately I do not have an answer for you yet but I have reached out for more information. I'll post on the thread as soon as I have something.

POSTED BY: James Choi

Thank you!

POSTED BY: Steven Zimmerman
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
POSTED BY: Updating Name
POSTED BY: Steven Zimmerman

Folding and unfolding the groups of cells :)

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