Message Boards Message Boards

[WSG21] Daily Study Group: Differential Equations (begins November 29)

A new study group devoted to Differential Equations begins next Monday! A list of daily topics can be found on our Daily Study Groups page. This group will be led by one of our outstanding Wolfram certified instructors, Luke Titus, and will meet daily, Monday to Friday, over the next three weeks. Luke will share the excellent lesson videos created by him for the upcoming Wolfram U course "Introduction to Differential Equations". Study group sessions include time for exercises, discussion and Q&A. This study group will help you achieve the "Course Completion" certificate for the "Introduction to Differential Equations" course after you complete the course quizzes.

Sign up: Study group registration page

POSTED BY: Devendra Kapadia
170 Replies

Hello Wolfram U team,

I'm not able to submit Quiz answers without errors. And all answers are incorrect, no matter which I choose.

For Quiz 1, the web site reports error messages, see attached image, similar to those reported above by Fabio and Luis.

John Burgers.

Attachment

Attachments:
POSTED BY: John Burgers

Michael,

Awesome idea, and I'm game. Definitely! I'll be mostly free after I give and grade the final exam in my undergraduate Fluid Mechanics, i.e., probably in two days. I would love to get involved in such a project. I'm not sure how long this discussion board will be available. So for this kind of collaboration, I propose that we deal with each other directly via email and/or skype or zoom. My email address is below.

Best wishes, Zbigniew

Giles and West House Faculty in Residence

919-667-5150 (c)

Zbigniew J. Kabala, PhD, PE, Associate Professor

Duke University

Department of Civil & Environmental Engineering

E-mail: kabala@duke.edu

http://www.cee.duke.edu/faculty/zbigniew-j-kabala


POSTED BY: Zbigniew Kabala

OK. Thanks. Btw, yesterday I sent there message about the MathOne , but did not hear back yet. Best. M

Could you please remind how to send questions about the quizzes? Thanks. M

Thank you, Zbigniew. It would be a pleasure to meet in person. However, I have an additional suggestion. As we are "here and now", and already found a common denominator, why don't we try doing together something useful for our learning of Differential Equations and Mathematica, and may be even beyond. I was thinking of writing a "computational essay" on the topic dealing with the non-linear oscillations (and, naturally, with the Differential Equations). And your last question sounded to me like a natural part of this project. The problem that I have in mind deals with a simple "(almost) High school level" system, which may display, (almost) in spirit of NKS, very complex behavior. A while ago, we have done some ground work with my son, and I can send a short note on the subject (for anyone interested in this endeavor).

PS This is not just a personal message. Anyone on the forum, who is interested, is welcome to join this discussion (some background in Math and physics would be very helpful). I am very grateful to the Wolfram-U team and personally to Luke for creating such an inspiring and productive atmosphere.

Thanks, Michael for your pointers and kind words. I appreciate them. Also, I'm fascinated by your lab. I can't wait till the next Wolfram conference, hopefully in person, and am looking forward to meeting you. Cheers, Zbigniew

POSTED BY: Zbigniew Kabala

Thanks, Luke, I really appreciate the pointer. Cheers, Zbigniew

POSTED BY: Zbigniew Kabala

Thank you, Luke. Just double-checking: If the functions are polynomial, then, in order to find the coefficients in the series expansion of y(x), you can use them (the functions) "as is". If they are analytic but not polynomial, you need fist to expand them and then to find the (coefficients in the expansion of ) y(x). Is it correct?

Thank you. M

Posted 2 years ago

Same here enter image description here

POSTED BY: Luis Marin

Thank you Zbigniew for this insightful post.

Our College math professor called HGF "The mother of all bombs". And he really meant it, being in his youth a part of the "Russian Manhattan Project". I should also mention Dr. Eric Weinstein and his MathWorld (a part of WR) - the outstanding Encyclopedia of Math, which (in conjunction with Wolfrfam Demo projects) allows to test many concepts using the Mathematica.

PS: Morse and Feshbach, in my view, is still a great resource to be kept in the vicinity of your desk :)

Hi Zbigniew, Could you please email wolfram-u@wolfram.com from the email you used to register for the study group? We can check to make sure you receive the reminders.

Hi Hakan, Please email wolfram-u@wolfram.com directly about any feedback related to the course.

Hi Jürgen, We will address this more details at today's session to clarify all questions about accessing the lesson videos and the quizzes within the online course.

Hi Zbigniew. I did not derive that equation, but you can find a reference here: https://aip.scitation.org/doi/10.1063/1.4922268

POSTED BY: Luke Titus

Thanks for pointing that out. I'll make the change in the notebook.

POSTED BY: Luke Titus

That was just to simplify the discussion. The method works when they are general analytic functions, but the term analytic wasn't defined at that point.

POSTED BY: Luke Titus
Posted 2 years ago

Good morning,

I tried to submit Quiz 1 of the on-line course but I get an error during the grading (btw, it looks like no answer is correct!). I attach the image of the reported errors. Please, let me know if you have any ideas on what's going wrong.

Regards - - - Fabio

enter image description here

POSTED BY: Fabio Alcaro

Again, I would like to know how equation (1), in lesson 20, Special Functions, on slide 12 (see also my previous note), was derived.

Below is my attempt at it, in which I ended up with an expression involving the EllipticF function.

Wow! Surprisingly, it turns out that this expression is actually equivalent to the one involving the hypergeometric function. By the way, I'm amazed by the symbolic power of Mathematica in finding the integral and even more in finding that the two expressions are equal to each other. If I were to do it by paper and pencil, it would be ...

But the question still remains: how did you come up with (1)?

Attachment

Attachments:
POSTED BY: Zbigniew Kabala

In lesson 20, Special Functions, on slide 12, you whetted our appetites with the following statement:

   It can be shown that given a mass initially displaced at an angle theta_o on a pendulum, its
   period of oscillation will follow the hypergeometric function:  2F1[1/2, 1/2, 1, sin(theta_o)^2]

Well, it can be shown? SHOW US, please! Below, I comment on this statement.

Attachment

Attachments:
POSTED BY: Zbigniew Kabala

When clicking on the Feedback button in the online version of the course, it gives an "HTTP Error Code 404 - Oops, the page you're looking for can't be found.".

Before that is fixed, should I report comments / questions on the online version via the usual Wolfram support channels (i.e. email)?

[WSG21] Daily Study Group: Differential Equations (begins November 29)

Hi Michael, Oh, I have missed this one. Thanks for the pointer. Best, Zbigniew

POSTED BY: Zbigniew Kabala

Hi, Zbigniew. The mist important was about opening the course at the Wolfram-U site, with all the lectures, Quizzes and Exam posted there. With this you do not need to get the weekly invites (well, they will still send them as reminders). Did you get that one?

If you don't, please contact the team. I was cited a few times for sending the links through this forum.

Even though I'm registered for this study group, I stopped receiving notifications about the upcoming meetings as well as the follow-ups about their recordings. I would appreciate receiving those announcements.

POSTED BY: Zbigniew Kabala

Hi Abrita,

I did not receive any quizz on my Wolfram account. Furthermore, I am waiting for the link to the videos of prior sessions. Please help.

POSTED BY: Jürgen Kanz

Section 5, Exercise 2 The radius of convergence can be calculated using SumConvergence:

In[2]:= SumConvergence[n (2 x + 1)^n, n, Assumptions -> x [Element] Reals]

Out[2]= -1 < x < 0

Therefore, the series converges whenever -1<= x <= 0, so the radius of convergence is 1/2.

In the previous statement the original inequality -1 < x < 0 is substituted by -1<= x <= 0*. However, they are not equivalent, because the Sum [n,{n,0,Infinity }] does not converge.

To avoid the confusion, the "=" sign should be dropped.

  • The situation is slightly different in Exercise 1. Addressing this difference would be helpful for revealing a nuance in the definition of the radius of convergence.

I tried to post it before, but for some reason it did not work

Lesson 17, slide 1.

"When the coefficients of a linear second-order differential equation become polynomials, the equation appears in the form:

P(x) y''(x)+Q(x)y'(x)+R(x)y(x)=0 (1)"

This statement is correct but also slightly confusing. It may sound as if the form (1) relies on P, Q, and R being polynomial (while each of then can me (almost) any function of x). In my view, it would be better to say

"When the coefficients P, Q and R in the equation

  P(x) y''(x) + Q(x)y'(x) + R(x) y(x) =0

are the polynomial functions of x, the solution can be found by Taylor series expansion of y(x) ....".

Well. it's just about wording, sorry for being a nag.

OK, that's why I really need to get an account ! (?) Now I will follow your and Arben's advice and write Wolfram-U a letter :)

PS Just did it.

Congratulations and many thanks for the pre-release version of the course. Excelent!

Greetings from Barranquilla Colombia. Jorge O

Posted 2 years ago

I second that , The best WolframU course so far ......

POSTED BY: Doug Beveridge

Log into your Wolfram Cloud account. Navigate to the "Copied Files" directory within your Home directory. you will find your copy of the quiz notebooks there. enter image description here

How to copy a Quiz in the local NoteBook?

Posted 2 years ago

Lesson 17, slide 1.

"When the coefficients of a linear second-order differential equation become polynomials, the equation appears in the form:

P(x) y''(x)+Q(x)y'(x)+R(x)y(x)=0 (1)"

This statement is correct but also slightly confusing. It may sound as if the form (1) relies on P, Q, and R being polynomial (while each of then can me (almost) any function of x). Im my view, it could be better to say

"When the coefficients P, Q and R in the equation 

      P(x) y''(x) + Q(x)y'(x) + R(x) y(x) =0

      are the polynomial functions of x, the solution can be found by Taylor series expansion of y(x) ....".   

Well. it's just about wording, sorry for being a nag.

POSTED BY: Updating Name

[WSG21] Daily Study Group: Differential Equations (begins November 29)

A Level 1 certification will be available by taking the Final Exam available in the course. We hope to share the pre-release version of the course today with all our study-group attendees.

Is there a Level 1 Certification available for this study group?

POSTED BY: Peter Burbery

I'll comment on that at the beginning of the session today.

POSTED BY: Luke Titus

Wow! I would have never guessed it. So far I have been closing the code cells by double-clicking their output cell bracket. I've been a Mathematica user for a long time, but I didn't know that there was another option to do the same by selecting the code cell and then going to Cell >> Cell Properties and clicking or unclicking the box next to "Open" (in Linux). Again, I find it very interesting and, I bet, so would many other users. If I may, I suggest you point out this option during the Friday review. Many thanks for this pointer!

POSTED BY: Zbigniew Kabala

Thank you, Luke. I knew there must be a reason. I'm glad to know it now. Thanks again!

POSTED BY: Zbigniew Kabala

Thank you, Hakan for confirming my observation.

POSTED BY: Zbigniew Kabala

Hi Zbigniew. Using the Set vs SetDelayed (sol2[x]= vs sol3[x]:=) is just for presentation reasons. Using just = will display the output while using := will not display the output. They are both accomplishing the same task though.

POSTED BY: Luke Titus

Just above the output cell bracket you will see a tiny little cell bracket. Select that, then (on Windows) go to the menu Cell -> Cell Properties then select "Open"

POSTED BY: Luke Titus

Ah, this is interesting. I downloaded the files early as well, before they was zipped into a file. And I can confirm your findings: The new/current Lesson 11 (dates 2021-12-02 in the zip file) has indeed sol2 = ....

I also noted that the notebook has been converted to presentation notebooks, not the "continuous notebook" as I had earlier. (I tend to prefer the non continuous versions since they are easier to browse.)

Thanks for pointing this out. Now I've updated the notebooks.

No, I didn't do it. But, an excellent hypothesis, Hakan! It prompted me to investigate this matter further. I originally downloaded the materials before the meetings started. Then additional materials were added, so after one week into the course, I downloaded all the materials again (and I keep both zip files). It is there where this change took place. I downloaded the materials again a few minutes ago, and the "error" is there--you can confirm it yourself.

My question stands: is it an error or a correction? Or, perhaps, it doesn't matter, as both versions seem to work equally well.

POSTED BY: Zbigniew Kabala

In my notebook "Lesson 11", slide 12, the first sol you mentioned is also a delayed assignment:

Now you have almost found the same solution as that found by DSolveValue:

sol[x_] := c1 y1[x] + c2 y2[x]

Perhaps you have accidentally changed that := to = and the saved the notebook?

In lesson 11, slide 12, the solution of the problem in Example 1 is defined by means of the ASSIGNMENT, "=", whereas in slide 14, the analogous solution of the problem in Example 2 is defined by means of the DELAYED ASSIGNMENT, ": =". Traditionally, functions in Mathematica are defined via the delayed assignment. Is there a reason for the cited difference, or it simply doesn't matter? Please advise!

Attachment

Attachments:
POSTED BY: Zbigniew Kabala

I'm looking at the overview of Lesson 15. There is a nice working Manipulate implementation of the oscillating spring and a block attached to it. The code is hidden very well--I can't find it. In fact, the cell is marked as though there is no code associated with it. Where is the code for this Manipulate function? Please advise.

Attachment

Attachments:
POSTED BY: Zbigniew Kabala

From what you said, I take that using the "Function" is a more secure, bullet-proof approach. It is good to know! Thank you.

Unfortunately we have not been able to release the quizzes yet. We hope to release the quizzes on Friday along with the beta version of the entire course (including all the videos and the final exam). We'll clarify further at tomorrow's session.

Sorry for asking, but where should we look for the Quizzes? Is it at the usual "amoeba site" or anywhere else? Thank you.

Welcome to the study group. The reminder emails for the study group sessions will contain all the links you need for this study group--including the link to download all the notebooks and the links to the recordings.

Also you can access the previous recordings by clicking on the "Start this section" links for each day at the link posted by Michael above: https://www.bigmarker.com/series/daily-study-group-intro-to-differential-equations/series_details

Posted 2 years ago

I joined the study group today. How to download the previous lecture series ?

POSTED BY: KRISHAN SHARMA

Thank you. Still, it does not look pretty. It would be good to tune up the action of CoefficientList, so that it considers only non-zero elements. Am I asking too much ? :)

PS: It can be done by using If[], but it would not look neat either.

I think the way you are doing it is probably the best way simply. Deleting the zeros will be necessary since CoefficientList will consider all combinations of powers of the terms. The combinations of powers that do not appear will be given the value of zero, and those will need to be deleted.

POSTED BY: Luke Titus

Both ways will get the job done. However, using Function is a little more versatile as it can handled pretty much any form of the function. For example, if you had defined y1[x] instead as y1 = x^(1/2 (1 - Sqrt[5])), then y -> y1 wouldn't work and you would need to use y -> Function[x, Evaluate[y1]].

POSTED BY: Luke Titus

Thanks William! I really appreciate it.

POSTED BY: Luke Titus

Exercise 13(1). Just for practice, I tried to do it without "manual labor" while still reproducing all the steps of defining the "undetermined coefficients" . However, the implementation is sloppy. For instance , using "DeleteCases" to remove a bunch of 0s produced on the previous step, seems redundant. Apparently, I did not find the right version of the "CoefficientList[]" Please, advise.

eq =y''[x] + 2 y'[x] + y[x] - x^2 - 3 Sin[x] == 0;

parSol[x_]:= a Sin[x] + b Cos[x] + c x^2 + d x + e;

collConst = Collect[eq[[1]] /. y -> Function[x, parSol[x]], {x, Sin[x], Cos[x]}]

Out[39]= 2 c+2 d+e+(4 c+d) x+(-1+c) x^2+2 a Cos[x]+(-3-2 b) Sin[x]

In[40]:=
Solve[DeleteCases[Flatten[CoefficientList[collConst, {x, Sin[x], Cos[x]}]], 0] == Table[0, {5}], {a, b, c, d, e}]

Out[40]= {{ a->0, b->-(3/2), c->1, d->-4, e->6 }}

Luke,

Thanks!

That made it a lot clearer!

By the way, great course! Well-developed, well-executed!

William

POSTED BY: William Matthews

OK. I suspected that this was a didactic tool. Thanks for confirmation.

Thank you, Luke. I agree that exp (rx) is the decisive factor, but in our case we are not comparing exp (r x) with x, but rather x with 1.

Hi Michael. That term is there mainly to demonstrate the concept of an exact equation and the methods to solve them. You could definitely cancel that term and solve the equation much easier, but it wouldn't demonstrate how exact equations can be solved. Since you can cancel that term to get a simpler equation, it is a nice way to check the result obtained when using the methods of exact equations.

POSTED BY: Luke Titus

Hi William. Thank you for your question. It is an important point.

What we are doing in that step is identifying the terms terms that compose Phi(x,g). Notice that Phi(x,g) will consist of three terms. The first is a function of x and g, the second is a function of only x, and the third is a function of only g.

To calculate M, we take the partial derivative of Phi with respect to x. Therefore the part of Phi that is a function of only g will drop out because that partial derivative will be zero. Therefore, when we integrate M with respect to x we only get back the function dependent on g and x and the function dependent on x.

Similarly for N, that is calculated by taking the partial derivative of Phi with respect to g. Therefore, the part of Phi that depends only on g drops out when taking that partial derivative, so after integrating we only get back the function dependent on g and x and the function dependent on g.

We used integration to identify the parts of the function Phi. These are: a function dependent on g and x, a function dependent on only x, and a function dependent on only g. To obtain Phi, we do not add the results of the integrals, we just pick out these functions from the integrals.

POSTED BY: Luke Titus

Hi Michael. Yes, while the exponential term dominates the long term behavior, the factor of x should still be kept. I will fix that in the notebook for that exercise.

POSTED BY: Luke Titus

Exercise 12: Repeated characteristic roots.

Slide 5 ("exercise 4"), after the equation

y (x) = c1 exp (r x) + c2 x exp (rx),

it is stated: "Thus, we can conclude that the solution behaves like C exp (r x) at x-> Infinity". I guess this is a typo: it would be wrong in general to neglect the (dominant) contribution ~ x exp (r x) in comparison to ~ exp(r) in the limit of large x.

Sorry, the original expression in the lesson is: [Phi](x,g(x)) = g(x)ln(x)+3x^2-2g(x).

POSTED BY: William Matthews

In reviewing Lesson 7 on Exact Equation, Example 1, Slide 9, I'm confused about a particular step.

After integrating "M" & "N", expressions, we are told that the result of combining them to create the auxiliary function is: [Phi](x,g(x)) = 2 g(x) ln(x) + 3x^2 - 2g(x).

However, when you integrate "M", you get: 3 x^2 + g Log[x]; when you integrate "N", you get: - 2 g + g Log[x].

In the lesson, Luke indicates that, when combining "M" & "N", you consider the term that is common to them, g Log[x], only one time. This would give you the expression above for PHI.

Including it would give an expression with a "2" in front of the g(x) Ln(x) term: [Phi](x,g(x)) = 2 g(x) ln(x) + 3x^2- 2g(x). Using that expression, I got a slightly different answer for g[x] that had a "2" in front of the Log[x] term in the denominator.

My question: What allows us to ignore the second instance of g Log[x] when combining "M" & "N" to create PHI?

POSTED BY: William Matthews

Exercise 10(4)

y1[x_] := x^(1/2 (1 - Sqrt[5]));
y2[x_] := x^(1/2 (1 + Sqrt[5]));

What are the advantages of using [29]-[30] instead of [38]-[39]?

n[29]:= (x^2 y''[x]-y[x]==0)/.**y->Function[x,y1[x]]**//Simplify

Out[29]=True
In[30]:= (x^2 y''[x]-y[x]==0)/.**y->Function[x,y2[x]]**//Simplify

Out[30]=True

In[38]:= (x^2 y''[x]-y[x]==0)/.**y->y1**//Simplify

Out[38]=True

In[39]:= (x^2 y''[x]-y[x]==0)/.**y->y2**//Simplify

Out[39]=True

And similarly with the exercise 9(3) Thanks

Thank you, Devendra,

I didn't realize that all the different ways of expressing derivatives in Mathematica are based on the Derivative[n, m, ...][f][x, y, ...] function. All this makes perfect sense now.

Best, Zbigniew

POSTED BY: Zbigniew Kabala
Posted 2 years ago

Thank you, Devendra. Very nice: With "All", it displays the second element of all the solutions/assignments. M

PS It seems to me that in the early versions there was a spot reserved for the arrow "->" , so that {a -> 3.}[[1,2]] would return "->". Am I mistaken?

POSTED BY: Updating Name
Posted 2 years ago

My oversight, thank you.

POSTED BY: Richard Sweney

The problem is that you have assignments (=) instead of equatity (==) for y[0] and y'[0]. This should work:

DSolveValue[{4*y''[t] + 6*y'[t] + 2*y[t] == 0, y[0] == 5, y'[0] == 1/2}, y[t], t] // Expand

Note, however, that after you have evaluated the wrong DSolveValue expression, then Mathematica has saved the two assignments (y[0] = 5 and y'[0] = 1/2) and will interfere when evaluating the corrected expression.

One way to fix this is to restart the kernel after fixing the expression (e.g. using the Quit[] command).

Posted 2 years ago

I am getting an error message when I active DSolveValue for the verifying the solution in Exercise 4 of the second order ODE Exercise 9 set: "DSolveValue::deqn: Equation or list of equations expected in the first argument." The equation is clearly displayed. My example notebook is attached. Please advise how to fix this. Thanks.

Attachments:
POSTED BY: Richard Sweney

Hello Zbigniew,

The second one fails because Derivative requires a Function input as shown in In[3] below.

In[1]:= solution = 90 + C1 Exp[1/3 t];

In[2]:= (p'[t] == 1/3*p[t] - 30) /. p -> solution

Out[2]= Derivative[1][(90 + C1 E^(t/3))][t] == -30 + 1/3 (90 + C1 E^(t/3))[t]

In[3]:= f'[t] // InputForm

Out[3]//InputForm=
Derivative[1][f][t]

POSTED BY: Devendra Kapadia

Hello Michael,

Yes, that is correct for single ODEs but for a system you could use [[1,All,2]], as shown below.

In[1]:= DSolve[y'[x] == 1, y[x], x][[1, 1, 2]]

Out[1]= x + C[1]

In[2]:= DSolveValue[y'[x] == 1, y[x], x]

Out[2]= x + C[1]

In[3]:= DSolve[{y'[x] == 1, z'[x] == 2}, {y[x], z[x]}, x][[1, All, 2]]

Out[3]= {x + C[1], 2 x + C[2]}

In[4]:= DSolveValue[{y'[x] == 1, z'[x] == 2}, {y[x], z[x]}, x]

Out[4]= {x + C[1], 2 x + C[2]}

POSTED BY: Devendra Kapadia

Friday sessions for this series will start at 10:30 AM CT with the review session for the week running from 10:30-11:00 and the day's lesson beginning at 11:00 AM CT.

When does today's session start? Thanks.

In the Lesson 7,

the first equation 5 e^y(t)+5 t e^y(t) dy/dt =0 is equivalent to dy/dt = - 1/t; which is trivially solved in one line: y(t) = - ln(t) + c What is the purpose of multiplying both sides by "5 e^y(t)" and making the simple solution more complicate? Is it done for purely *didactic * reasons?

From Lesson # 3, Verify a Solution: Why do we need to use Functon & Evaluate:

solution = 90 + C1 Exp[1/3 t];

verify = (p'[t] == 1/3*p[t] - 30) /. p -> Function[t, Evaluate[solution]]

Why do the following two statements FAIL?

1) verify = (p'[t] == 1/3*p[t] - 30) /. p -> Function[t, solution]

OR

2) verify = (p'[t] == 1/3*p[t] - 30) /. p -> solution

OK, the first one fails, perhaps, because of the HoldAll attribute for Function. But why does the second one fail when there is no HoldAll attribute there?

POSTED BY: Zbigniew Kabala

Is it fair to say that DSolveValue [...] is simply equivalent to DSolve [...] [[1,1,2]]?

Hello ! For some reason the GeneratedParameters function does not work for me the GeneratedParameters function does not work

Could you help me ? thank you

Posted 2 years ago

If there is just one argument the { } can be omitted. For multiple arguments

f = Function[{x, y}, x*y];
f[3, 4]
(* 12 *)
POSTED BY: Rohit Namjoshi

Great! Thank you, Devendra, for opening the hood. Also, I did not realize that "body" is the second argument. Apparently, I had in mind a function of several variables. All the best. M

Hello Michael,

In Function[x, body], the variable 'x' is the first 'argument' and the expression 'body' is the second 'argument'.

The variable 'x' is effectively a 'local' (Module) variable inside Function and hence, as shown below, the function evaluation does not depend upon its name.

IIn[1]:= f = Function[x, x^2];

In[2]:= g = Function[a, a^2];

In[3]:= f[5]

Out[3]= 25

In[4]:= g[5]

Out[4]= 25

In[5]:= f[x]

Out[5]= x^2

In[6]:= g[x]

Out[6]= x^2

Also, technically, Function has the attribute HoldAll:

In[7]:= Attributes[Function]

Out[7]= {HoldAll, Protected}

In practice, this means that the second argument 'body' is not evaluated by Function, so Evaluate is required below (since 'body' is defined outside Function).

In[8]:= body = x^2;

In[9]:= Function[x, body][5] (*incorrect*)

Out[9]= x^2

In[10]:= Function[x, Evaluate[body]][5] (*correct*)

Out[10]= 25

Hope this helps.

POSTED BY: Devendra Kapadia
Posted 2 years ago

Yes, I also find it strange that the "Function does not evaluate its second argument automatically". When I first ran into the problem I tried a number of alternatives and the error will occur without using "Function" . I cannot fathom the reason for Wolfram doing this ....

enter image description here

POSTED BY: Doug Beveridge

Thanks, Vincent. Could you please explain what's the meaning of "1" in the list. Is it the module (length) of the vector which is, in fact, variable (but this is apparently handled by color coding) or something else? The lecture said that the "1" is D[x,x] , but why are we taking this derivative?

Thank you.

Thank you, Devendra. When you said "Function does not evaluate its second argument automatically" was it a general statement, or one related to a particular example? What would the "second argument" mean in general? M

Thank you. I wonder which is a better way to avoid a naming conflict: localizing p[x] using , say, Module, or by using

/. {p -> Function[{x}, Evaluate[solution]]}

Could you please provide an alternative example? Thanks. M

Posted 2 years ago

Thank you very much!

POSTED BY: D. R. Grimes

A link to the download folder containing all the lecture notebooks (as well as any additional materials used during the sessions) is included in the reminder email you receive from BigMarker. It will also be shared in the live session everyday of the study group series.

Posted 2 years ago

Where are the mathematica notebooks for the sessions stored?

POSTED BY: D. R. Grimes

Function does not evaluate its second argument automatically, so you could use Evaluate as shown below to achieve the desired result in the first case:

In[1]:= sol = DSolveValue[p''[x] + 2 p'[x] - 3 p[x] == 0, p[x], x]

Out[1]= E^(-3 x) C[1] + E^x C[2]

In[2]:= solution = sol /. {C[1] -> 1, C[2] -> 0}

Out[2]= E^(-3 x)

In[3]:= verify = 
 p''[x] + 2 p'[x] - 3 p[x] == 
   0 /. {p -> Function[{x}, Evaluate[solution]]}

Out[3]= True

POSTED BY: Devendra Kapadia
Posted 2 years ago

Hi

I am trying to resolve this trivial problem trying to verify a solution . In the first run I get the incorrect answer but in the second run if I substitute the solution directly into the 4th line I get the correct answer . Any suggestions ?

enter image description here

POSTED BY: Doug Beveridge

ok, the first list is slope, got it,

POSTED BY: vincent feng

I notice for the form y'(x)=f(x,y(x))

we can use VectorPlot[{1,rhs}...] as direction field, how to derive this? thanks,

POSTED BY: vincent feng
Posted 2 years ago

In the email giving a link to the first recording. a link to the Series Landing Page is given as

Link to the Series Landing Page

https://wolfr.am/YxPcS9oQ

This is the landing page for the previous session ("Introduction to Notebooks")

What is the correct landing page ?

POSTED BY: Doug Beveridge
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