2
$\begingroup$

I found a notebook that symbolically applies the multiple time scales method to any differential equations. I don't like just using other people's code so I am going through the author's work line by line. I am new to Mathematica so I am looking up each function and reading about the syntax as I go through the code. Unfortunately I am running into issues because it appears the Mathematica language has changed since the creation of the notebook.

I think I was able to fix the first error I received by removing the <<Algebra ReIm; line since it seems ReIm is an outdated package. The second error I am receiving is

Function::flpar: "Parameter specification {T[0],T[1]} in 
Function[{T[0],T[1]},Cos[ω\ T[0]]\ C[1][T[1]]+Sin[ω\ T[0]]\ 
C[2][T[1]]] should be a symbol or a list of symbols."

Which I get from line

zerosol = DSolve[zeroordereqn == 0, 
   x[0], {T[0], T[1]}] /. {C[_][#2]*Cos[omega_.*#1] + C[_][#2]*Sin[omega_.*#1] -> 
    A[#2]*Exp[I*omega*#1] + Conjugate[A[#2]]*Exp[-I*omega*#1]}

I am not sure how to fix this error, I believe it has to do with T[ 0 ] and T[ 1 ] not being initialize properly. I would appreciate any help with the issue.

I have included a link to the notebook file in case you need more information to help answer this question.

I am sorry if this is a simple question, but I am pretty new to Mathematica and not sure where to look to find the solution.

Thanks in advance,

Casey

$\endgroup$
1
$\begingroup$

The error itself may be isolated to this operation:

zeroordereqn = ω^2 x[0][T[0],T[1]]+(x[0]^(2,0))[T[0],T[1]];

DSolve[zeroordereqn == 0, x[0], {T[0], T[1]}]

DSolve gives a result in terms of a Function using the parameters T[0] and T[1] but this is not valid. Perhaps at some time DSolve gave different output but I cannot test that. However if one replaces T[0] and T[1] with t0 and t1 the error is avoided:

DSolve[zeroordereqn == 0 /. {T[0] -> t0, T[1] -> t1}, x[0], {t0, t1}]
{{x[0] -> Function[{t0,t1},Cos[t0 ω] C[1][t1]+Sin[t0 ω] C[2][t1]]}}

The fancy replacement at follows the DSolve however has no effect which leads me to believe that the output format is no longer compatible with this Notebook.

$\endgroup$
  • $\begingroup$ @Casey: I agree, but would start from the beginning, which is fixing InPowers using Symbol instead of indexed variables for T and x and working down. Therefore, it would be most useful to keep the unmodified workbook open and start out new by copy-pasting and using up-to-date Mathematica methods as you go. $\endgroup$ – Jinxed Feb 26 '15 at 2:31
  • $\begingroup$ @Jinxed Do you understand the transformation that was intended by the replacement following DSolve? $\endgroup$ – Mr.Wizard Feb 26 '15 at 2:54
  • $\begingroup$ I am pretty sure, that it is converting the pure function generated by the old Mathematica from trigonometrical to exponential form. $\endgroup$ – Jinxed Feb 26 '15 at 10:48
  • 1
    $\begingroup$ I think I will have a go on this old notebook this afternoon and try to bring it up-to-date from top to bottom. Let's see, if I manage to and how long it might take. $\endgroup$ – Jinxed Feb 26 '15 at 10:56
0
$\begingroup$

I managed to update the workbook for Mathematica-10-compatibility, but stopped just before the section Duffing Equation.

I also did not copy the original explanatory texts (yet), since this will need some refurbishing also.

Here is what I managed so far (just copy, paste and execute):

NotebookPut@Uncompress@"1:eJztPQ10HMV5si1kGwcMOAHS8OjZBNtyT7LuJGNLxQJbP0 
aAf6pTDI1/5JW0J699d3va27Nlg1M/AiXQl1Ly05emvJbETUvySFKISYEQUvLchLT0kbbEcc 
FxeHnE/BRcp4G8QF9L7pvdvZvZ2d2Z2dk7nYj8nnd0u7Mz833z/c83s4tH9MF0U0NDQ2Fe6b 
JJN9URXd+bvhzuNJYuN2oFMz3L+dWjZjLp2fDrPPvXBkMv5nsVU7Ful1+ZQ7yCGphbuqzXJ1 
FldAO6HdT3l+6lzyFenu2MJ2UeyKil5yloTp3IpaDeQC5f9KoDbcaYNdYKteEeZyONF+zp/G 
AoBFubzf8Ujdsa/TLsug1drac7IsDd7wXWgDuxIOSRALHRM4cAER5s72pr7+lEY9mJrkneuc 
IwRGLFghyuLdbfDNoMHiQ8TaDrSnS9ym7fGXz/KrsTQeglgLMQ1S45/XBnLZt32io13HVhsI 
PFjFpY2GBJhZ7dSm5cHdKyakGFGgAwlCd+dv62lYv+a90FpxM7obx0z5IRKB99/aExKFdMzN 
WgfOTmNzJQisqaYMQKzLYF1/mAg2JeNQqjhpY3ARMuUk36EBb/HLbwCMwFpUu/oYyamp5z5i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p59tiXQO190nj276C8f/Lxr0LZf6j34RptKC 
DBhQ/7QWZFSsvmM1r6QE3MXdGDsaUVpkx/HAI5+i/ZcsvHqL6wEndb8GLphY7IqoKtQx355T 
3SZkcqup7S/F7tECZ9GrmjNNz+OBFECb1RCtpYulRsorptWhV61x5XN0HnYb+A8/+Hf/4I2m 
LV2PQY8rnm3fBtKLv/9D++C2X8z+/9ZyhP3Z8/XhNfjN9T4zmN018rkvEaN0lwHnrl8Y0Z0U 
hSDKMJiWAQz0eo3R0ScaRqQdxOQRn15HFA7gwi5DT7HvxWZ1NOH4PbHtC5M/2MIcCvRCfjFG 
t3o6FCEwQFGAONv4skknF8/ieeRH98eeHqY0Sccv6l6WfQKsIX/vW4UBSDDTHnaZwoMt6jZ/ 
Ol+tYLrDRSlFyrm+qIru/doJpc71xU+qNvn5IpogVt523MkAgfa3vxytQLgLpdzf94Csl38v 
X5lZ51w4rG6qP4hidUC1aBb9JyY/r+lHbQnd8CfyQSbausP5Ltq10vn1d+eaNijGs5V3TalU 
gDA1pXNPVsCRWj2uk5+BqyR4VLG6hF5oWI2fWc2Zcb21oiYVjSuAqG1tbaFkvrRmyjNgrGXN 
qMWcMqxJZf1dEyopnNseW96qgKidGxjngs2ZboaPZI2UHbF3phTz7KBCrYGeFppZgxW3Mjvw 
GfvqWM";
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.