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

12 Likes

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.

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

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?

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

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

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

2 Likes

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

1 Like

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.

2 Likes

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.

1 Like

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

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!

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

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

1 Like

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.

A proposed solution to the exercise.

ebook]1

20230526 JD SparseArray.nb (353 KB)

1 Like

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.

2 Likes

Thanks!

2 Likes

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.

2 Likes

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.

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.

1 Like