Guest User

Untitled

a guest
Mar 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. documentclass[]{article}
  2. usepackage{sagetex}
  3. usepackage{xcolor}
  4.  
  5. lstset{language=Sage,
  6. commentstyle={ttfamilycolor{green}},
  7. keywordstyle={ttfamilycolor{blue}bfseries},
  8. stringstyle ={ttfamilycolor{dgraycolor}bfseries},
  9. tabsize = 4,
  10. basicstyle={small ttfamily},
  11. backgroundcolor= color{orange!20},
  12. }
  13.  
  14. begin{document}
  15. The following function computes the square of a number:
  16. begin{sageblock}
  17. def f(x):
  18. return x**2
  19. end{sageblock}
  20.  
  21. Testing in the code gives for $x=2$ the value sage{f(2)}.
  22.  
  23. Commandline Version:
  24. begin{sagecommandline}
  25. sage: x = 2
  26. sage: f(2)
  27. end{sagecommandline}
  28.  
  29. end{document}
Add Comment
Please, Sign In to add comment