[WSG21] Daily Study Group: programming tutorials

Daily Study Groups are back, now providing expertise on practical programming! After a short break, we’re starting up with a series that picks up where Wolfram Language Basics sessions ended. This 3-week series will take you from basic programming concepts to package development.

Need tips on improving your code’s speed or functionality? Programming Tutorials offer a great opportunity to level-up your skills while interacting with software development professionals. See hands-on examples and get questions answered by Wolfram Language experts. Plus: participants who pass weekly quizzes are awarded a program completion certificate. Level 1 certification is available for those who pass manually graded exercises.

Join us any time between August 2 and August 20! Check out our registration page for more details.

11 Likes

I have never participated in a webinar like this. The study materials .nb downloads. Don’t look familiar or readable. What am I supposed to do with them?

The .nb files are Wolfram Notebooks. You can open and work with the notebooks with a free trial.

Download files again , this has been corrected .

Right! Sorry for the error.

What is the Level I Certification in, exactly? Is it different from the Wolfram Technology Level I Certification?

Can I have the link to the “Series 15 Programming Tutorials” webpage containing the exercises etc

Here is the series landing page, where you can see details and from where all session recordings will be linked: https://www.bigmarker.com/series/daily-study-group-programming-tutorials/series_details

The weekly quizzes will be announced on Fridays, and the exercises will be announced during the final week of the Study Group. Watch your email notifications for direct links to recordings, the quizzes and exercises, and additional resources.
[1]: Webinar: Daily Study Group: Programming Tutorials by Wolfram Research

1 Like

For this Study Group, the certification refers to Wolfram Technology Certified Level 1 for proficiency in using the Wolfram Language. This Level 1 certification is equivalent to the one you can earn by taking the Wolfram Language Level 1 exam on the Wolfram U website.

1 Like

The weekly quizzes will be announced on Fridays, and the exercises will be announced during the final week of the Study Group. Watch your email notifications for direct links to recordings, the quizzes and exercises, and additional resources.

I am in the Programming Study Group.

I have a practical problem I am trying to solve. I am trying to make a network graph on a hexagonal/triangular grid. All of the edges are directional and I need to have each edge represented by a symmetrical trapezoid where the edge thickness is narrower at the originating point than at the destination point on the grid. I was hoping EdgeShapeFunction would allow me to do this, but while GraphElementData knows about trapezoids, Wolfram Language doesn’t seem to want to let me use a trapezoid as an EdgeShapeFunction. Is there another way to accomplish this?

Here is something to get you started:

Graph[{1 -> 2, 2 -> 3, 3 -> 1}, 
 EdgeShapeFunction -> 
  Function[{coord, edge}, 
   Tooltip[
    Triangle[{First[coord], Last[coord] + {0, 0.04}, 
      Last[coord] - {0, 0.04}}], {First@coord, Last@coord}]]]

The EdgeShapeFunction needs to be set to a pure function that will take the coordinates of the edge line and create something closer to your requirements. In the above example I created a triangle.
The Tooltip is only intended to show what the inputs to the pure function look like when it tries to draw the edge.

1 Like

Very cool trick. I had no idea we had that much control over the appearance of a graph.

I didn’t see a recording for Day 2. Is there one?

Each session is recorded. You can access the recordings from the Study Group series landing page, by clicking the link to each daily section. Registration is required. Here is a link to Day 2: https://www.bigmarker.com/wolfram-u/dsg15-iterations-counting-and-lists

How do choose not as a condition with patterns?
For example,

mylist={1,1.5,2,3,3.14,2.718}
list /. _! Integer :> "Real"

I was also wondering how to replace all integers with “Int” and all reals with “Real” in one line.
I think there is a way to use replace with lists

mylist /. {_Integer, _Real} :> {"Integer", "Real"}

The previous code does not work.
How would I use conditions and patterns to replace each element of string list equal to False with Style[False, Red] and each element of string list equal to True with Style[True, Green]?

stringlist={True,False,False,True,False,False,True,False,True,True,False}

Example Notebook->

Hi Peter,

The “obvious” ways don’t work

mylist /. Except[_Integer] :> "Real"
mylist /. _?(Not@IntegerQ[#] &) :> "Real"

both result in “Real” because the pattern matches at level 0. Have to use Replace and specify a levelspec

Replace[mylist , Except[_Integer] :> "Real", 1]
Replace[mylist , _?(Not@IntegerQ[#] &) :> "Real", 1]
(* {1, "Real", 2, 3, "Real", "Real"} *)

Need to specify the rules individually

mylist /. {_Integer -> "Integer", _Real -> "Real"}
(* {"Integer", "Real", "Integer", "Integer", "Real", "Real"} *)

stringlist is not a List of String,

stringlist = {True,False,False,True,False,False,True,False,True,True,False} 
Head /@ stringlist
(* {Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol} *)

Since they are either True or False

Style[If[#, Green, Red]] & /@ stringlist
1 Like

Re-read your last question. I think this is what you were looking for

Style[#, If[#, Green, Red]] & /@ stringlist

6028plot.png

2 Likes

Thank you that fixed it!

I am working on mapping the nearest nuclear reactor and first aim to select nuclear reactors that are in the United States.
I have the following code:
Select[EntityList[EntityClass["NuclearReactor", All]], EntityValue[#, "Countries"] == Entity["Country", "UnitedStates"] &]

but receive an empty list as a result for some reason.
How can I select all nuclear reactors in the US?
I would like to use the Select function.

1 Like