Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm running a pretty straightforward Mathematica script:

ninfphase = 10;

Infinitycs = Module[{n = ninfphase, c},
Clear[c];
veqexp =
 CoefficientList[
 Series[(1/
   r)(-2 - l r - l^2 r +
     2 (r + I r^3 \[Omega]) Derivative[1][v][
       r] + (-2 + r) r^2 Derivative[1][v][r]^2 + (-2 + r) r^2 (
       v^\[Prime]\[Prime])[r]) /. {v'[r_] :>
     Sum[-i c[i]/r^(i + 1), {i, 1, n}],
    v''[r_] :>
     Sum[i (i + 1) c[i]/r^(i + 2), {i, 1, n}]}, {r, \[Infinity],
   n - 1}], r^-1];
Do[c[i] = c[i] /. Simplify[Solve[veqexp[[i]] == 0, c[i]][[1]]];
Print, {i, 1, n}] ;
Table[c[i], {i, 1, n}]];

SetDirectory["/someDir"];
DumpSave["myfile.mx", Infinitycs];

Exit[];

If I run this on Mathematica GUI on my desktop all is good and it works and gives the desired output, however when I do Copy>Copy as Input Text (as is pasted above) in the notebook and paste it into the text editor nano on the server I would actually like to do the computation on, then I get errors relating to the recursion limit being reached or element does not exist. I've tried deleting all the white space I can find and even putting it all on one line but still I seem to get some error or another; is there a way to copy over from Mathematica to nano to faithfully reproduce my script on the server?

For example if I edit in nano to give

ninfphase = 10;

Infinitycs = Module[{n = ninfphase, c}, Clear[c];
veqexp = CoefficientList[Series[(1/r)(-2 - l r - l^2 r +2 (r + I r^3 Omega]) Derivative[1][v][r] + (-2 + r) r^2 Derivative[1][v][r]^2 + (-2 + r) r^2 (v^\[Prime]\[Prime])[r]) /. {v'[r_] :> Sum[-i c[i]/r^(i $
Do[c[i] = c[i] /. Simplify[Solve[veqexp[[i]] == 0, c[i]][[1]]]; Table[c[i], {i, 1, n}]];

SetDirectory["/someDir"];
DumpSave["myfile.mx", Infinitycs];

Exit[];

Then instead I get the error

 Syntax::sntue: Unexpected end of file (probably unfinished expression) 
  (line 11 of "genInfinitycs").
share|improve this question
2  
Instead of trying to debug your terminal connection, I think I'd simply suggest saving a .m file and using scp to transfer it. –  Jens Feb 8 '13 at 17:48
    
Things like this have happened to me too. Just follow Jens's suggestion and it'll be fine. –  Szabolcs Feb 8 '13 at 17:51
    
Ah thanks, I didn't know I could do it that way-would certainly be easier! –  fpghost Feb 8 '13 at 17:57
    
I have now tried the suggestion to save as .m and the entries in the file when viewed in nano look like (* ::Input:: *) (*ninfphase=10;*) (**) when I run it using math -run "<< file.m"` it doesn't seem to do anything. If I remove the comments (* then I am back to my original errors. –  fpghost Feb 11 '13 at 19:15
    
The main error is ReplaceAll::reps: {{}[[1]]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. then all the others seem to stem from this. –  fpghost Feb 11 '13 at 19:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.