Message Boards Message Boards

GROUPS:

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

Posted 12 days ago
884 Views
|
30 Replies
|
20 Total Likes
|

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

30 Replies

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 3 days ago

Where are the mathematica notebooks for the sessions stored?

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 3 days ago

Thank you very much!

When does today's session start? Thanks.

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.

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,

ok, the first list is slope, got it,

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.

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

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

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

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

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

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.

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

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

f = Function[{x, y}, x*y];
f[3, 4]
(* 12 *)

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

Could you help me ? thank you

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

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

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?

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]

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

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?

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:

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

DSolveValue[{4y''[t] + 6y'[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).

My oversight, thank you.

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

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

Thanks

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