Message Boards Message Boards

[WSG23] Daily Study Group: Wolfram for Mathematics Research and Study

A Wolfram U daily study group covering the implementation of Mathematica and Wolfram Language for mathematics topics ranging from function visualization to upcoming calculus functionality begins on May 22, 2023 and runs through June 1. This study group will run on weekdays from 11:00AM–12:00PM Central US time. (We will not meet on Memorial Day, May 29, and Friday sessions will start at 10:30AM for extra review time.)

REGISTER HERE. I hope to see you there!

This study group is a fantastic way to learn about the amazing mathematical capabilities built into Wolfram Language. We will cover a very broad variety of topics, including but not limited to function visualization, linear algebra and graph theory, differential equations and even fascinating topics such as number theory and asymptotics. Several sessions will be led by the Wolfram developers who work on the mathematics functionality that we'll be covering!

While this study group is aimed at mathematics students at roughly the graduate level, no prior Wolfram Language experience is necessary—the first day will be dedicated to getting you up to speed with the language itself. As usual, we will have questions, study materials, quizzes along the way to help you master the subject matter and functionality.

enter image description here

POSTED BY: Arben Kalziqi
74 Replies

I could use some advice on recommended ways to write functions. The function I am trying to write factors numbers. I am specifically targeting large numbers that have two prime factors. I want to eliminate all of the obvious factors (e.g. 2, 3, 5 etc.) So I started to write the following function, where c is the number being factored. I imagine there are several ways to factor a number by inspection, so far my function only has two tests, but could have more. Should I use Catch[] and Throw[] or Return[] or something different?

factorByInspection[c_]:= (
Catch[
If[EvenQ[c], Throw[{2, c/2}] ]
If[divFiveQ[c],Throw[ {5, c/5}]]
])
POSTED BY: Michael O'Connor

Hi Mike—please check out my answer in the thread for the current Study Group: https://community.wolfram.com/groups/-/m/t/2972173

POSTED BY: Arben Kalziqi

Arben, in the Elementary Introduction book interactive course chapter 11, there was an exercise about finding how many words in a list-o-words start with [some particular letter]. I answered:

StringContainsQ[StringTake[WordList[],1],"q"] // Counts // Lookup[True]

I thought that was a clever method, but the engine grades my response with a "Try Again". Is there something lacking in my response? Where does one go to report glitches in the exercise-engine for this course?

As an aside, I really like the numerous exercises in that course. It has more of a "practice the scales" component than study group tests. Nothing is as good as your live courses, but this interactive course is pretty darn neat.

POSTED BY: Phil Earnhardt

Hey Phil—that's a totally reasonable solution to that problem, yes. The only issue is that the autograder used there is quite a complicated object, and it doesn't always get everything right. (For quizzes and other assessments, we try to update it whenever we find one of these false negatives, but it's not always possible.)

I thought that Counts[StringContainsQ[StringTake[WordList[], 1], "q"]][True] might be taken a little bit better, but no dice :)

POSTED BY: Arben Kalziqi

I downloaded my own copy of the quiz, and I left the original in my collection of web artifacts. I filled in the answers and got an automatic grade for the test. I saved the test back to the collection of web artifacts, but when I open it, it's blank. Did the quiz results make it to you, and where can I find my filled in copy of the quiz?

Hi, Robert. After observing the quiz behaviors over several study groups, I've concluded that the cloud quiz engine is a "live wire" -- it is running asynchronous code back to the mother ship. I once left a filled-out-but-unsubmitted cloud-quiz sitting around for a day. My answers got cleared before submitting; that was definitely a Teachable Moment. It seems up to each student to identify the quirky behaviors of cloud-based Wolfram-U Notebooks and figure out how to work with them.

The quizzes have a button to download the quiz-notebook; I have gotten in the habit of downloading the notebook, working through the questions in that quiz notebook in my own version of Wolfram Desktop, and answering the questions there. That locally-running version of the quiz isn't a "live wire"; it doesn't ever self-clear or have any unexpected behaviors. When I'm ready to submit my quiz, I manually transfer my answers to the cloud-version of the quiz.

If you don't have access to a local version of Wolfram Desktop/Mathematica, you could grab images of the quiz questions and put them in a new cloud notebook. That would give you the quiz without getting the quirky behaviors of their quiz-engine.

Quizzes are hard to create and hard to administer -- and sometimes hard to take. With ChatGPT and other LLMs, quiz mechanics may become even more difficult. Or maybe the AIs will rapidly become skilled at teaching us with automatically-generated Wolfram-Lessons. Interesting times for sure!

POSTED BY: Phil Earnhardt
Posted 1 year ago

Arben, Thanks for your description of the quiz festivities. I wonder how Wolfram knows to calculate the grade on the download file if it isn't via a live wire. I used your manual copy from my downloaded quiz to the one I thought was the real thing, and neither saved my answers. Bob

POSTED BY: Robert Lyons
Posted 1 year ago

Hi, Arben! I very much appreciate the work that you and your Wolfram colleagues put into this class --and all the other classes I've taken. You make it fun to work on and learn even the most complex topics.

I have some questions about the admin of the final quiz. I downloaded my own copy of the quiz, and I left the original in my collection of web artifacts. I filled in the answers and got an automatic grade for the test. I saved the test back to the collection of web artifacts, but when I open it, it's blank. Did the quiz results make it to you, and where can I find my filled in copy of the quiz? Thanks for a great course! Bob

POSTED BY: Robert Lyons

Hi Robert—thanks for your kind words! I think that the giest of what Phil said is correct—probably you ought to submit the quiz directly online. Let me know if that doesn't work, and we'll look into it!

POSTED BY: Arben Kalziqi

This has been a great course with lots of inspirational gold nuggets. I can only dream of what a mind blowing experience going to college these days could be like with a tool like this at my finger tips.

Quick question: I got tired of the beeps warning me that the class notes were created in a newer version of Mathematica so I downloaded and installed is labeled as the latest version 13.2.1.0 on my current service plan, and I am still getting the beeps that tell me the notebooks I am opening were created on a newer version.

Does anybody know why? Are you working in a newer, perhaps unreleased version?

POSTED BY: Carl Hahn

I am still getting the beeps that tell me the notebooks I am opening were created on a newer version. [...] Does anybody know why? Are you working in a newer, perhaps unreleased version?

Arben noted that [unreleased] version 13.3 is floating around in-house earlier in this discussion:

That would have been created on 13.3, probably. We should have set this in the notebooks we uploaded, but looks like we missed this—that notebook is in slideshow view. Just go to Format -> Screen Environment and change that to Working, and it'll become a scrollable notebook rather than a presentation notebook.

IMHO, the bleeping warning isn't too bad, but maybe there should be a way to keep the warning from popping up. OTOH, loading a Notebook in slide mode can be terribly confusing for newbies if you don't understand that there are different modes for displaying a notebook. Fortunately, I was able to figure this out pretty early: I asked a Q about that during an online session in the first Study Group I attended. At this point, my fingers just automagically to hit COMMAND-minus [on my Mac] to set the Screen Environment to Working. I'm guessing a disconnect over the Screen Environment in slide mode is fairly frequent: somebody here thought the Notebooks they were loading were "bad" because they didn't see how to scroll past the first Slide in one of those notebooks.

WL Notebooks written with earlier versions of Mathematica are always compatible. That is remarkable. Mathematica 1.0 was released in 1988; it's staggering that one can still read Notebooks created 35 years ago. I don't think any other software package has that track record of backwards compatibility.

POSTED BY: Phil Earnhardt

Hi everybody—the completed Differential Geometry notebook (with my and John's parts in addition to some of the extra references John made live) is now available in the materials folder.

Good luck on the quiz!

EDIT: I should also note that the review, including the "mini-lecture" on the intersection of linear and differential operators, Hamiltonian mechanics, differential eigensystems, and so on has also been uploaded in full.

POSTED BY: Arben Kalziqi
Posted 1 year ago

Great course! Thanks, Arben & Co.
But there may still be a bug in the use of a quiz by itself without a framework showing overall progress. I took it on Saturday and got 89% correct (16 correct out of 18). It said I could take it again if I wanted but also didn't confirm I had now passed the quiz. Even without the framework, it should not leave the student in the dark in respect to passing the exam. The same issue happened a few weeks ago in another Wolfram-U course. (I am running MacOS 12.6.6 & Safari 16.5.)

POSTED BY: John Davidson

Great point, John—we'll be doing this going forward. (We have that in our MOOC quizzes but hadn't implemented it yet in our standalone ones.)

POSTED BY: Arben Kalziqi

WRT Wolfram Study Groups, there's one other administrative detail that could make a difference.

In one of the lecture Q&A sessions last week, Cassidy noted that videos of the lectures will remain online as long as Wolfram Research has a contract with BigMarker (i.e., a long time). However, the lectures are inaccessible unless one has access to the URL for each lecture. Those "recording available" URLs are unique for every lecture and each is e-mailed once to each participant. They come with a tag of "bu=" plus a very long sequence of hexadecimal numbers, which implies the URLs are tagged and unique for each participant.

I have started a practice of assembling all URLs for WL Notebooks and BigMarker Videos in an archive for each SG that I take. As I see it, Wolfram Research could do one of three things for Study Group participants to help them organize an archive of the materials for a course:

  1. Make a specific recommendation during Session 1 of a course to suggest participants to create a document archiving links to the the training materials for the Study Group. The archive would be useful for review for the quiz, and useful for longer-term review of the material.

  2. Provide a WL Notebook with functionality for creating, editing, and saving an archive of the materials for a course.

  3. 2-3 business days after course completion, send an e-mail to course participants providing a document with links to all course materials. This document could be bundled with the "reminder" e-mail about the quiz deadline for the course.

Hmmm. After writing those three, I suppose #1 makes the most sense. #2 would be complicated to make a robust functionality, and #3 may be difficult for Wolfram U to automate adding URLs with any user-specific tags needed in the URLs. If generic URLs could be provided for the videos, then drafting the archive for this e-mail becomes much easier.

CC @Jamie Peterson

POSTED BY: Phil Earnhardt

Yes. Good course. @Wolfram U: You don't have to be a math or physics major to appreciate and learn from this course. You can quote me on that. :)

Good quiz, too. If a W SG quiz is well-written, you'll learn at least a thing or two while taking the quiz.

One resource that @Arben didn't mention WRT differential geometry (and many other things) was the Wolfram Mathworld online reference. I had found Viviani's Curve in an unlikely place (an exercise instruction video); that article helped me understand and explain that oscillating motion. While Mathworld entries are similar to Wikipedia articles, I find the quality and writing of Mathworld articles are consistently high and superior to the Wikipedia. Mathworld articles originate as Wolfram Notebooks; all are available for download. Once you're conversant in the Wolfram Language, you can directly use/modify the code implementing those graphical science articles.

POSTED BY: Phil Earnhardt

Yep, I get you! How about this? (It's been a long time since I've heard or thought about Larmour frequencies, so let me know if this is not right.)

POSTED BY: Arben Kalziqi

Thank you Arben. Great study of simple physics. I could not do it, but know I know how.

Really enjoyed the study group. Re-learned a lot I had forgotten and many new capabilities I never knew before. The quiz is fun too. Looking forward to a next time.

Larry

POSTED BY: laurence bloxham

Thanks Larry; I'm glad it was helpful! hopefully it paves a path forward for you to analyze and visualize other systems. I'm happy that we were able to to introduce and re-introduce you to various functionality, too!

POSTED BY: Arben Kalziqi

FWIW, I have gone through several study groups with Version 12.2 (on MacOS). It's not optimal to do this, but I've had no major problems. For many reasons, I plan to upgrade soon. I'm certain that Wolfram U staff posts with the most recent version (which can always be found here). Current version is 13.2.1.

There's always a cost to not being current. There was a question on this quiz that I wanted to make sure my answer was correct against the current version. To do this, I opened a notebook on cloud.wolfram.com and evaluated the expressions there. In any case, it's worth being familiar with accessing WL Notebooks through the cloud.

POSTED BY: Phil Earnhardt
Posted 1 year ago

I figured out my problem. Sorry for the last msg.

POSTED BY: Peter Fedkiw
Posted 1 year ago

I downloaded the notebooks for the study group today, and I found that I receive an error message on opening some of the lesson books. So, for example, I can open and read the notebook file "Linear Algebra and Graphs" but the file "WGS40-Asymptotics" does not open. I receive a Mathematica-generated error dialog box "Why the Beep" that tells me "This notebook was created in a more recent version of the Wolfram System ..." I am running version 13.2.1.0. I hope that you can help me fix the issue.

POSTED BY: Peter Fedkiw

Hi Peter—there's no issue, it's just a warning that the notebooks were made in a newer version so there might be some functionality that doesn't work because it doesn't exist in your installation.

POSTED BY: Arben Kalziqi
Posted 1 year ago

When I open the "Linear Algebra ..." notebook (and others that generate the same error message), the only page that appears in the notebook is the title page. There is no other content in the notebook (well, at least that I can see). BTW .... What version was used to create the "Linear Algebra ..." notebook?

POSTED BY: Peter Fedkiw

That would have been created on 13.3, probably. We should have set this in the notebooks we uploaded, but looks like we missed this—that notebook is in slideshow view. Just go to Format -> Screen Environment and change that to Working, and it'll become a scrollable notebook rather than a presentation notebook.

POSTED BY: Arben Kalziqi

I have a (mathematically) simple homework question today, but one that I think is a good exercise for people to try out—especially if they're newer to Wolfram Language.

  1. The function tanViz from today's lecture currently only accepts a function and has predefined ranges for its two parameters. Modify tanViz so that it accepts ranges (as lists) for the two parameters u and v as inputs. That is, an input should look like: tanViz[surface,{ui,uf},{vi,vf}]. The resultant Manipulate object will then have sliders that range over the values that you specify.

  2. Modify the Manipulate object such that it has a Slider2D input for the two parameters, as you saw in the Hamiltonian example from Tuesday. This will let you change u and v simultaneously.

POSTED BY: Arben Kalziqi

Tuesday's example of the Hamitonian classical mechanics was in 1 dimensional phase space. How should the code be modified to model n-dimensions?

POSTED BY: laurence bloxham

It was in two-dimensional phase space, right? Or perhaps you mean that the phase space path was a plane curve with only one parameter? You can use ParametricPlot3D to plot space curves (for, say, a one-parameter three-dimensional phase space, like observing how position, momentum, and energy change as a function of time) or surfaces (for a two-parameter three-dimensional space).

If you mean the equation-solving itself, then you simply add more equations and variables to the (N)DSolve, though that can quickly increase the solution difficulty of course.

POSTED BY: Arben Kalziqi

Help me with the 2d Hamiltonian: H[q1,q1,p1,p1,t]. q1'=dH/dp1, q2'=dH/dp2, p1'=-dH/dq1, p2'=-dH/dq2 all partial derivatives. Hspace i R^2d+1.

POSTED BY: laurence bloxham

Thank you for your help. A Hamiltonian for a particle moving in a plane experiencing a magnetic field orthogonal to the planes is: H[q1,q2,p1,p2]= 1/2m (p1-Bq2)^2 +p2^2.

Seek solution to Hamilton's equations and the general solutions for the trajectory of the particle.

POSTED BY: laurence bloxham

Does H not depend on q1, or is that dependence encoded into the magnetic field?

POSTED BY: Arben Kalziqi

I am trying to describe the dynamics of a particle confined to the plane. There is no q1 dependence. The trajectories should be circles in the plane with the Larmour frequency. Hope I am making sense. Thanks again.

POSTED BY: laurence bloxham

enter image description here

Hi, I am trying to work with the notebook from the "Differential Equations" lecture yesterday. For some reason, when I run the DSolve code, it's giving me this error message: I'm not sure if it's because I ran the code out of order but I tried deleting the notebook and redownloading it and it's still showing this. Any idea of how I can fix this? I'm new to mathematica so I'm sure I'm missing something basic.

I also don't understand why the numbering on the In[#] and Out[#] is continuous throughout all the different notebooks I have. Is there a way to make them separate? Thanks so much!

POSTED BY: Allison Byars
Posted 1 year ago

Dear Allison, it seems t has ans assigned value/expression in this case a list. Try clearing the variable, write and evaluate:

Clear[t]

above the differential equation.

POSTED BY: José Dordá

Hi Allison! This is something that happens quite frequently to newer (and even more veteran) users. José is correct: it looks like at some point you defined the variable t. You can actually tell that this is the case in your screenshot: the t is black, meaning that it has a definition assigned to it. Hopefully the error message now makes sense. You can get rid of this definition by running ClearAll[t], for examples.

As for how/why this persisted even in your new copy of the notebook: Mathematica is basically broken into two pieces, the kernel adn the frontend. The kernel is what does all of the actual computations, which are then fed back to you in the notebook frontend. This kernel, by default, is persistent until the program—not a window—is closed, and the kernel is consistent between notebooks, which means that notebooks which are simultanously open will share definitions and also the In/Out counts, as you noticed.

If you'd like a notebook to have its own kernel, you can go to the top-level menu and click Evaluation->Notebook's Kernel, then pick a new one. You may first have to go to Evaluation->Kernel Configuration Options to "set up" a new one, though. You can kill the kernel at any time (and thus clear all definitions and In/Out counts) from that same menu.

Hopefully this helps!

POSTED BY: Arben Kalziqi

Dave, the behavior I have observed repeatedly is that community.wolfram.com loses the cookie that identifies my Wolfram-ID. When I click on the reply window, I am immediately (and un-magically) forwarded to another window to log in. I click the back button in the browser; the problem persists. The fix I have found is to do a Reload of the web page, and the Wolfram BBS then knows who I am. This was horribly confusing the first 7-8 times it happened; it's now in my muscle memory to do the Reload. I pity the newbies who hit this glitch for themselves and hope they rapidly get it in their muscle memory. For background information, I"m using Safari 16.5 in MacOS 12.6.6. I reported this about 3 months ago; I haven't heard from anyone.

I truly appreciate how much Wolfram Research dogfoods their own software. The WL is used for essentially everything customer-focused in the company. OTOH, I don't believe that the community.wolfram.com bboards are the right place to use a WL-based solution. There are some superb bboard systems out there: Discourse, Discord, etc. These solutions are used by millions of people daily, have standalone clients on a bunch of computer and portable platforms, etc. Most important, the primary purpose of those companies is to provide agile world-class community-discussion systems.

BBoard functionality is not a priority for WR; it's probably not in the top 50 list (or top 100) of priorities for the company. It shouldn't be. All that WR needs is their BBS to have the proper HTML wrapping to interpret/relay the WL cloud expressions in messages. Wolfram shouldn't make a web browser or a streaming service. IMHO, they should not use a WL implementation of a bboard, either.

@Arben Kalziqi , are there any compelling technical reasons to have a WL-based bboard implementation? Is there some functionality the management thinks can't be done in Discourse/Discord/etc.? I've made repeated public comments similar to this one, but haven't received any responses. What gives?

POSTED BY: Phil Earnhardt

Hi Phil, thanks for the suggestion; I will Reload a Community page before I post next time. It's a good practice in general as I also missed the latest post by Arben Kalziqi.

POSTED BY: Dave Middleton

Hi Phil,

Thank you for your feedback. We have sent you a message on your email address.

POSTED BY: Ahmed Elbanna

There were two questions for previous presenters to which I've just received answers:

A question for Lusine, who gave the talk on number theory:

I would be interested in what is the title of the book about number theory and when the new online course is expected to be launched on number theory mentioned during this session.

Lusine notes that the book is not yet complete and the title has not been finalized, but it will probably have a rather traditional name like Introduction to Number Theory.

A question for Jaebum, who gave the talk on linear algebra and graphs:

I would appreciate if you could mention some references (e.g. books, articles, web pages) that contain already accomplished research topics in Wolfram language related to graphs.

Jaebum has provided three examples:

  1. Analyzing Narratives in Social Networks
  2. Operator Calculus on Graphs, Theory and Applications in Computer Science
  3. Functional Networks with Applications
POSTED BY: Arben Kalziqi

Hi, this is an admin Q.: Thanks for the great series! I have not been receiving any of the links to the session recordings (or even email reminders). Who should I contact to correct this? Thanks!

POSTED BY: Claude Pelletier

Send an e-mail to wolfram-u@wolfram.com with any administrative questions.

[Not an admin, but I know the answer to this one!]

POSTED BY: Phil Earnhardt

Phil is right! We did have an issue with another user's email address on BigMarker's end for some reason, so maybe the same thing is happening to you. We're looking into it!

EDIT: Actually, this was fxed during the minute I typed this post. You should be good to go now.

POSTED BY: Arben Kalziqi

Thanks!

POSTED BY: Claude Pelletier

Hi Claude, I have reached out to our event platform and you should now receive the notification emails. It seems you had unsubscribed from the BigMarker emails at some point.

Please let me know if you have further issues or questions.

Best Wishes, Cassidy Hinkle

POSTED BY: Cassidy Hinkle

Great thanks!

POSTED BY: Claude Pelletier

Regarding f[ ]: I like the consistent use of [ ] and not using ( ) for functions, or indiscriminately. I think one problem at least in elementary mathematics is our overuse of ( ) in different contexts, which confuses beginning students (and sometimes even seasoned mathematicians). So using [ ] for functions, { } for domains, and ( ) for only grouping actually makes the language of mathematics better.

I'm glad you think so! I agree that it's nice to reduce ambiguity in this way; it's been helpful to my students in the past as well (who would often get confused by notation when learning about vectors, for example).

POSTED BY: Arben Kalziqi

My brain gets lost in bracket hell with deeply nested [[],[[],[[]]],[[]]] even when they are nicely indented. I find that using postfix operations makes these expressions much easier to understand. E.g.

Of the first 1000 primes which ones have a digit sum that is also prime?

Select[Map[Total, AssociationMap[IntegerDigits, Prime[Range[1000]]]], PrimeQ]

Range[1000] // Prime // AssociationMap[IntegerDigits/*Total] // Select[PrimeQ]

To understand the first one you have to work from inside to out. The second one maps naturally to the question in left-to-right, easy to read, and understand order.

POSTED BY: Rohit Namjoshi

It is interesting to note that learning to work "inside out" with functions is a struggle many learners of traditional math notation have as well. The prefix (@), postfix (//), and functional ([]) styles of notation can be mixed and matched however makes the most sense for you in a given problem.

POSTED BY: John McNally

Reverse Polish notation :) Reminds me of old HP calculators, and FORTH! So, all in all, pretty familiar to me. I actually prefer the prefix f@ argument, and using vectors for multivariate arguments, like f@{z, y, z}

Reverse Polish notation :) Reminds me of old HP calculators [...]

If you still have a longing for those fabulous HP calculators of lore, you can now scratch that itch. There's a Swiss startup that is making modern implementations of RPN calculators inspired by the old 16C, 42S, and 41CX machines. I'm grateful that somebody had the capability and the nerve to resurrect these machines. I'm also grateful that the US printer toner company that created those calculators doesn't sue that startup into oblivion.

POSTED BY: Phil Earnhardt

Thanks for the hint regarding the HP41C clone! There are of course downloadable Apps that do (all or mostly) the same for less on your i-phone, but there is something magical about holding an HP41C calculator in your hand and not using your cell phone... I did a lot of solid RF Systems Engineering on my HP 41C before PCs and spreadsheets. I may just have to order one...

POSTED BY: Carl Hahn

Indeed, I wind up doing that myself pretty frequently. The only thing to keep in mind is that f[{x,y,z}]!=f[x,y,z], of course, but if you're defining your own functions it isn't a big problem.

However! If you take advantage of Apply (@@) and MapApply(@@@) and understand how slots work, you can mix and match and get the best of both worlds.

POSTED BY: Arben Kalziqi
Posted 1 year ago

I am on travel and will miss a few workshop meetings. I reviewed the lesson on Asymptotics, and I have a few questions about the Singular Perturbation portion of the notebook.

  1. The help file for AsymptoticDSolveValue lists options that may be set in the function, but I cannot find examples on how to set a value for the option when executing the AsymptoticDSolveValue command. Specifically, I want to compare the results using the "Quality" option to that obtained using "Speed". Hope that you can provide an example for each.

  2. The example in the workbook shows how to find an asymptotic solution for the boundary-value problem, eqn = {[Epsilon] (y^[Prime][Prime])[x] + 2 Derivative[1][y][x] + y[x] == 0, y[0] == 0, y[1] == 1/2}; The solution presented seems to be implicitly a uniformly valid expansion for all x in the domain. [See plot in this section.] . What method was used to generate the asymptotic expansion solution presented in the workbook? That is, I typically use the method of matched asymptotic series for the inner and outer solution of the boundary-layer problem. The method of matched asymptotic solutions will generate a uniformly valide solution composite solution for all x. The boundary conditions will be satisfied exactly at both x=0 and x=1. The solution in the workbook, however, does not exactly satisfy the boundary condition y[1]=1/2. There is a small difference between the asymptotic soln value and the set value of 1/2. The difference is appreciable when epsilon is of O( 0.1) or larger. It appears that the method of matched asymptotics is not used in the Mathematica algorithm to generate the result in the workbook. What method does the code use?

Thanks

POSTED BY: Peter Fedkiw

Hello Peter,

Thank you for these interesting questions.

  1. The PerformanceGoal option for AsymptoticDSolveValue is set to "Quality" by default, and the "Speed" setting is only used to disallow the use of exact methods based on DSolve, for computing an asymptotic approximation. You will probably not need this option very often but the following rather artificial example illustrates its use in AsymptoticDSolveValue:

    In[1]:= deqns = {y'[x] + Sqrt[x]  y'[x]^2 == 1, y[1] == 1};
    
    In[2]:= AsymptoticDSolveValue[deqns, y[x], {x, 0, 3}]
    
    Out[2]= 1/6 (11 + 5 Sqrt[5]) - 2 Sqrt[x] - x + (2 x^(3/2))/3 - x^2 + 
     2 x^(5/2) - (14 x^3)/3
    
    In[3]:= AsymptoticDSolveValue[deqns, y[x], {x, 0, 3}, 
     PerformanceGoal -> "Quality"]
    
    Out[3]= 1/6 (11 + 5 Sqrt[5]) - 2 Sqrt[x] - x + (2 x^(3/2))/3 - x^2 + 
     2 x^(5/2) - (14 x^3)/3
    
    In[4]:= AsymptoticDSolveValue[deqns, y[x], {x, 0, 3}, 
      PerformanceGoal -> "Speed"] // Head
    
    Out[4]= AsymptoticDSolveValue
    
  2. The leading order approximation for the singular perturbation problem is computed using a simple "closed form" for it based on a discussion in Chapter 9 of Bender and Orszag which works well for second-order linear ODEs for which the coefficient of y'[x] is positive on the given interval. However, as you have noted, the boundary condition at x = 1 is only satisfied asymptotically with this formula. One of the "later" perturbation methods in AsymptoticDSolveValue uses the WKBJ method which yields an approximation that is more complicated but does satisfy the boundary conditions (and also works for higher-order approximations). This method can be accessed as follows:

    In[1]:= eqns = {ep y''[x] + c Derivative[1][y][x] + 
         y[x] == 0, y[0] == 0, y[1] == 1/2};
    
    In[2]:= psol = 
     AsymptoticDSolveValue[eqns, y[x], x, {ep, 0, 1}] /. c -> 2
    
    Out[2]= E^(1/2 + 2/ep - x/2)/(2 (-E + E^(2/ep))) - E^(
     1/2 + 2/ep + (-2 x + (ep x)/2)/ep)/(2 (-E + E^(2/ep)))
    
    In[3]:= psol /. x -> 0
    
    Out[3]= 0
    
    In[4]:= psol /. x -> 1 // Simplify
    
    Out[4]= 1/2
    
    In[5]:= dsol = DSolveValue[eqns /. c -> 2, y[x], x]
    
    Out[5]= -((
     E^(1/ep + Sqrt[1 - ep]/
       ep) (E^((-(1/ep) - Sqrt[1 - ep]/ep) x) - 
        E^((-(1/ep) + Sqrt[1 - ep]/ep) x)))/(
     2 (-1 + E^((2 Sqrt[1 - ep])/ep))))
    
    In[6]:= Limit[dsol/psol, ep -> 0, Assumptions -> 0 < x < 1]
    
    Out[6]= 1
    

    Hope this helps.

POSTED BY: Devendra Kapadia

Hi everybody—today's "homework" question:

Part 1:

Use PrimePi and SparseArray's ability to specify elements via patterns to generate the following (10x10) matrix:

{{1, 2, 0, 0, 0, 0, 0, 0, 0, 0}, {2, 2, 3, 0, 0, 0, 0, 0, 0, 0}, {0, 
  3, 3, 4, 0, 0, 0, 0, 0, 0}, {0, 0, 4, 4, 4, 0, 0, 0, 0, 0}, {0, 0, 
  0, 4, 4, 5, 0, 0, 0, 0}, {0, 0, 0, 0, 5, 5, 6, 0, 0, 0}, {0, 0, 0, 
  0, 0, 6, 6, 6, 0, 0}, {0, 0, 0, 0, 0, 0, 6, 6, 7, 0}, {0, 0, 0, 0, 
  0, 0, 0, 7, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 8, 8}}

sparseViz

Part 2:

Modify the code above such that it produces a 30x30 matrix rather than a 10x10 one, then create a graph which has the result as its adjacency matrix. (Try using a circular embedding for the graph layout.)

POSTED BY: Arben Kalziqi
Posted 1 year ago

A proposed solution to the exercise.

ebook][1]

Attachments:
POSTED BY: José Dordá

Thanks Jose, this looks great! (and of course, I appreciate the Manipulate.)

There's a more compact way to write the pattern-matching for the initial SparseArray, if you're interested—recall that the Conditional statement can be any computation at all, not limited to checking equality, for example. I'm not sure if that's enough of a hint, but I'll post my version as a reply to this if you like, as I wouldn't want to spoil it before you've had a chance to think of it.

POSTED BY: Arben Kalziqi

Here's a way to get the SpaceArray without the dreaded index scaffolding:

Two comments:

In past classes, I had been opening the Wolfram Language & System Documentation Center in a browser window. I accidentally opened the docs center in a Wolfram Language window. Opening the help docs in the Wolfram Language app is vastly superior! You can run a line or 2 of code immediately right in the documentation window. Also, you're not thrown by the distraction of browser windows in your Wolfram explorations.

I am not a mathematician; I had difficulty brushing off the cobwebs in the recent Wolfram Calculus Study Group. OTOH, I remembered enough about matrix math to remember that the diagonals next to the main diagonal of a matrix were highly useful -- and there must be a way to access them. There had to be a built-in library function to get to them! It took me a couple of days to find Band. If I had looked in the "See Also" section of the docs for SparseArray, I would have found Band much much faster. There is a brilliance in the design of the WL; great minds have laid out a wonderful... array... of functions.

POSTED BY: Phil Earnhardt

Terrible pun, Phil, I'm afraid you've gotta get out of here ;). I agree about local documentation; I really prefer it even though we don't bundle it by default anymore since it's gotten so large (though it's easy to download and install anyway). Our publishing guidelines are to link to webdocs, but I was thinking during today's lecture that I might ask to see if we can use local in some contexts, primarily for the reason you mention—click to copy is nice, but "edit and run" is a lot nicer!

Re: the homework problem, Band is a clever thought to have had. I must confirm that the fears you mentioned in chat have come to pass, though, as I generated the SparseArray as follows (and hopefully José sees this too, since it's a reply to the original comment):

sparse = 
 SparseArray[{i_, j_} /; Abs[i - j] <= 1 -> PrimePi[i + j], {10, 10}]

(Fortunately, I think you'll find this elegant enough to forgive me.)

POSTED BY: Arben Kalziqi

I think it's OK to use Abs to see the "distance" from the diagonal. OTOH, your code ends of applying that test to every cell (or, at least, the calculated value of the coordinates of every cell) in the matrix. You're doing a bunch of superfluous computation; it should be slower:

I'm gonna give that a No Pass.

POSTED BY: Phil Earnhardt

Ha! But the question explicitly specifies the dimensions, so unless you're an incredibly fast typist, mine is still faster in the real world (and that's still true even in the case of your 11 million times larger array). I'll wag my finger and note that knowing when it's prudent to optimize is just as important as knowing how to optimize. (Contrarily: in a high-level language such as this, being able to think about sources of potential slowdown like you have is an invaluable skill!)

POSTED BY: Arben Kalziqi

Dear Arben,

Just missed your reply with the solution of Part 1 (no browser refresh).

I joined the Study Group in the second week. Apparently, I posted my solution as someone else (Vitaliy Kaurov, WOLFRAM Research) which is very weird (I used a VPN). The impersonated post is below. I reported the issue to Wolfram Support.
[Update] WR has restored my post attribution.

POSTED BY: Dave Middleton

Thanks for letting us know, Dave—there's a strange issue with Community which sometimes occurs where the original username gets removed, and our "default" username in cases like those is Vitaliy's (ostensibly because he's the Director of Community Engagement).

POSTED BY: Arben Kalziqi

Arben, what did you mean by " I agree about local documentation; I really prefer it even though we don't bundle it by default anymore since it's gotten so large (though it's easy to download and install anyway)." I am running 13.0.0. and it seems to me my documentation is local, but I don't remember doing anything special to download it. I am going to upgrade one of these days and that gave me pause. I wouldn't dream of not having the full documentation local and be subject to Internet access. What has changed?

POSTED BY: Carl Hahn

Hi Carl—starting with a recent version of the language, fresh installs no longer come with the documentation by default. If I remember correctly, the user is asked during the installation process whether they would like to download and install local documentation. If not (or if they choose "no"), it's as simple as going to the menu and choosing something like "Download and Install Documentation". You don't—and as far as I know, never will—need a persistent internet connection to access documentation. It's just that the documentation is now on the order of a few gigabytes, so it was decided to leave it out by default and make it an optional installation.

POSTED BY: Arben Kalziqi

Is it this Arben for the Part 1 code?

Normal@SparseArray[{{i_, j_} /; (Abs[i - j] <= 1) -> 
     PrimePi[i + j]}, {10, 10}] // MatrixForm
POSTED BY: Dave Middleton
Posted 1 year ago

Dear Arben,

I found a shorter code for the sparse array. If you have a different approach please share.

I also have a question in the attached document as I get some error messages and I can solve ir for the manipulate option.

Best regards

Attachments:
POSTED BY: José Dordá

Yes José, that's basically the idea—the only difference is that I used Abs instead of checking whether it was between ±1. I'll check out your notebook when I have the chance, hopefully today.

POSTED BY: Arben Kalziqi

I am curious about the automated proof system you mentioned on Tuesday. Can it detect statements that are unprovable in the current set of axioms (re: Goedel)? Or is that function not computable (Turing/Kleene) hence not doable by computer?

Hi Alexander, in the details section of the documentation of FindEquationalProof, it clarifies this somewhat. In cases where the function is able determine it is not possible to prove the given theorem from the axioms, it will return a Failure object. However, as you mention, in full generality it is not possible to decide this and the only option is to let the program run to see if it terminates. For this reason there is also a TimeConstraint option to impose an artificial limit on how long the function will keep running. You can also manually stop any ongoing evaluation by clicking Abort Evaluation under the Evaluation menu in the user interface.

POSTED BY: John McNally

In Tuesday's presentation on Special Functions and Visualization, John McNally noted the use of Simplify or FullSimplify but cautioned that FullSimplify can take more time.

Is that really still the case? On modern processors, doesn't FullSimplify simply run fast enough? Do you have a real example where FullSimplify would make a noticeable difference?

POSTED BY: Phil Earnhardt

Hi Phil—hopefully John and Charles were able to answer your question in the webinar chat today. To wit, they mentioned that certain trigonometric simplifications were available via FullSimplify which wouldn't be tried with Simplify, and that this could result in simpler results at the cost of slower speeds. John also mentioned that there are trig-specific simplification functions like TrigExpand which can work several orders of magnitude faster than either of the more general simplification functions.

POSTED BY: Arben Kalziqi

The study group schedule notes that the Thursday June 1 session is about probability and differential geometry. I have a question about torsional forces. As noted in the wikipedia:

In the differential geometry of curves in three dimensions, the torsion of a curve measures how sharply it is twisting out of the osculating plane. Taken together, the curvature and the torsion of a space curve are analogous to the curvature of a plane curve.

I'd love to see a computation and visualization of the torsion of a 3D curve in the Wolfram Language. If this doesn't fit into the scheduled presentation, could you show an example (with WL Notebook) in the community discussion here? Thank you.

POSTED BY: Phil Earnhardt

Hi Phil! That's a lovely suggestion; I'll see if I can work it in.

POSTED BY: Arben Kalziqi
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