Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • $\begingroup$ The above code is not fine since it evaluated with message NDSolve::ivcon: The given initial conditions were not consistent with the differential-algebraic equations. NDSolve will attempt to correct the values. $\endgroup$ Commented Feb 6, 2022 at 12:33
  • $\begingroup$ @AlexTrounev Thanks. I think my confusion has nothing to do with NDSolve, eventhoug Mathematica gives such a nice warning. solGolbal and solModule use the same solution output by the NDSolve. In my option, even if this output is not the accurate solution to my ODEs, solGolbal and solModule should still give the same reuslt. $\endgroup$ Commented Feb 6, 2022 at 12:51
  • 1
    $\begingroup$ The sample is not properly simplified, but the underlying problem is interesting. It can be boiled down to the following: Module[{rule = a -> b}, expr = Sin[t]; f[t_] = D[expr, t] /. rule] I myself didn't know that renaming will happen in this case. Since Module and renaming have been discussed quite a bit in this site, I won't be surprised if it's still a duplicate, but I don't have time to search for it at the moment. $\endgroup$ Commented Feb 6, 2022 at 13:39
  • $\begingroup$ @xzczd Yes, yes! This is the exact what I am looking for. I will search Module realted posts. Thanks! $\endgroup$ Commented Feb 6, 2022 at 13:45
  • 1
    $\begingroup$ A further simplification: Module[{rule = a -> b}, f[t_] = t /. rule] gives t$. $\endgroup$ Commented Feb 6, 2022 at 13:49