I have answered question on using Computer Algebra System (CAS) in LyX via Ryacas. You can see the answer here. In summary, LyX has a way to work with different CAS internally, but I have shown how to use Ryacas via Sweave in LyX. I sent yesterday a note on the latter to Rnews. Stay tuned!