variables get deleted after calulation, overflow?
Hello and happy 1000 questions,
I tried to solve an equation and wanted to reinsert the solutions so I can check weather everything worked correctly. But after the calculations are finished, all variables and their values are gone. Here is the code
var('n,R,T')
var('test,test2,test3')
eq1 = ((n-1)^2/(n+1)^2)==(-1-2*R+R^2-T^2+sqrt(4*T^2+(1-2*R+R^2-T^2)^2))/(2*R-4)
sol=solve(eq1,n,solution_dict=true)
test = (eq1.substitute(n=sol[0][n]))
test2 = test*(test.lhs().denominator())*(test.rhs().denominator())
test3 = expand(test2).full_simplify()
show(test3)
Errorcode:
Traceback (click to the left of this block for traceback)
File "<stdin>", line 1, in <module>
File "_sage_input_3.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZXEx"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpDYArBS/___code___.py", line 2, in <module>
exec compile(u'eq1
File "", line 1, in <module>
NameError: name 'eq1' is not defined
I'm working with sage SageVersion 4.7.2 under win7 with Oracle VirtualBox as recommended. Thanks in advance.
Rather than using ">", to get the formatting for code right it's easiest to select the pasted code and hit the button above the text box which reads "101 010". Alternatively you can indent by four spaces.
Thank you. And it's a lot easier than the way I did it.
When I tried "show(test3)", I got a different error. The latex string for test3 is *very* long, long enough that a closing brace "}" is too far away from the corresponding starting one, so latex (or jsmath) fails. I'm not sure what you expect "show" to do with such long output, anyway. For what it's worth, "show(test2)" works fine for me.
Theoretically, I expect show(test3) to give me zero. But even when I just write test3 instead of show(test3) I get the same error.
I have a question - how long does it take for you to run this? It's been running for QUITE a while for me now and I don't even have test3 done yet. Maybe you are running out of memory or something...