# How do I run programs from Mathematica 5 or 6 in Mathematica 9 ??

1771 Views
|
2 Replies
|
1 Total Likes
|
 I want to run some programs written in Mathematica 5 and 6 using Mathematica 9 or 10.  Some DSolve functions don't work in 9 or 10 but do in 6 (if written in 6).  Are there legacy packages for 9 or 10? This is from "Computer Solutions in Physics" by Steve VanWyk, Chapter 4.5Clear[r,y];sol1=DSolve[{2*(y^\[Prime])[r]+r*(y^\[DoublePrime])[r]==-.262468*(-13.60r+14.3996)*y[r],y[0.0001]==1,(y^\[Prime])[30]==0},y[r],r]Plot[Evaluate[y[r]/.sol1,{r,.000000001,.000001}]]
2 Replies
Sort By:
Posted 10 years ago
 The issue here is that your DSolve code is not running.  First let's write out the equations in your DSolve code:{2 y'[r]+r y''[r]==-0.262468 (14.3996 -13.6 r) y[r],y[0.0001]==1,y'[30]==0}If you plug this into DSolve, it won't run. DSolve is for symbolic solutions of differential equations and this equation uses floating point numbers. Floating point numbers really don't obey the normal rules of algebra, so we can't often get DSolve to work with them. One quick trick is to turn the floating point numbers into rational numbers using the Rationalize function:Rationalize@{2 y'[r]+r y''[r]==-0.262468 (14.3996 -13.6 r) y[r],y[0.0001]==1,y'[30]==0}This result can be used in DSolve:DSolve[{2 y'[r] + r y''[r] == -((65617 (35999/2500 - (68 r)/5) y[r])/250000), y[1/10000] == 1, y'[30] == 0}, y[r], r]Really, if you are not actually interested in the symbolic solution and want to use floating point number, you may want to use NDSolve instead of DSolve.
Posted 10 years ago
 Hello and welcome to the Wolfram Community! Please take a few minutes to read this tutorial about correct posting  especially of Mathematica code:How to type up a post: editor tutorial & general tipsIf you will not follow the tutorial, other members of community may not be able to test your code. To edit your post  click Edit in the lower right corner of your post.