Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2008-02-22 19:57:01
Size: 860
Editor: DavidHarvey
Comment: moving a tip from this page to FAQ.....
Revision 5 as of 2008-03-21 07:33:28
Size: 2197
Editor: DanDrake
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
 * [http://www.geogebra.org/cms/ GeoGebra] is a free and multi-platform dynamic mathematics software for schools that joins geometry, algebra and calculus. Here's how you can embed it in the SAGE notebook.  * '''!GeoGebra''' [http://www.geogebra.org/cms/ GeoGebra] is a free and multi-platform dynamic mathematics software for schools that joins geometry, algebra and calculus. Here's how you can embed it in the SAGE notebook.
Line 12: Line 12:

 * '''Vim filetypes''' To get Vim to use Python syntax highlighting, indentation, and so on for {{{.sage}}} files, put the following in {{{$VIM/filetype.vim}}}:

{{{augroup filetypedetect
  au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
augroup END
}}}
  If you are one of...''[http://www.gnu.org/software/emacs/ those people]'' you'll want to visit http://www.sagemath.org/emacs/.

 * '''Autocompletion for the bash shell''' So, you'd like bash to autocomplete Sage files, but you want to somehow exclude those {{{.py}}} files that have been autogenerated by Sage. Here's a snippet that will do that for you. Put this somewhere where it will get sourced, such as your {{{.bashrc}}}, {{{.bash_profile}}}, or whatever. Often bash is set up so that it will automatically pull in completions defined in {{{~/.bash_completion}}}. Here's the code:

{{{_sagecomp()
{
   local cur files
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    files="$(compgen -o dirnames -X '!*.@(sage|?(s)pyx|py)' -f ${cur})"
    if [[ "$files" ]]
    then
      COMPREPLY=($(egrep -L '^# This file was \*autogenerated\* from the file .*\.sage' $files))
    fi
}
complete -F _sagecomp sage
}}}
  See [http://www.debian-administration.org/articles/317 this article] for more information. --DanDrake

Tips for Using SAGE

  • GeoGebra [http://www.geogebra.org/cms/ GeoGebra] is a free and multi-platform dynamic mathematics software for schools that joins geometry, algebra and calculus. Here's how you can embed it in the SAGE notebook.

    1. In GeoGebra: Create some geometric construction or plot an algebraic expression. See [http://www.geogebra.org/cms/index.php?option=com_content&task=blogcategory&id=69&Itemid=56 this page] for more details.

    2. In GeoGebra: File> Export> Dynamic worksheet.

    3. Open the .html just exported with a text editor and copy the <applet> section.

    4. In SAGE notebook: Data> Upload the .jar and .ggb files just exported.

    5. In SAGE notebook: Edit> Paste the <applet> section.

    6. In the <applet> section, change codebase="./data/", you can also set some of the flags to true.

    7. Save changes, and you're done.
  • Vim filetypes To get Vim to use Python syntax highlighting, indentation, and so on for .sage files, put the following in $VIM/filetype.vim:

{{{augroup filetypedetect

augroup END }}}

  • Autocompletion for the bash shell So, you'd like bash to autocomplete Sage files, but you want to somehow exclude those .py files that have been autogenerated by Sage. Here's a snippet that will do that for you. Put this somewhere where it will get sourced, such as your .bashrc, .bash_profile, or whatever. Often bash is set up so that it will automatically pull in completions defined in ~/.bash_completion. Here's the code:

{{{_sagecomp() {

  • local cur files
    • COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}"

      files="(compgen -o dirnames -X '!*.@(sage|?(s)pyx|py)' -f {cur})" if "$files" then

      • COMPREPLY=((egrep -L '^# This file was \*autogenerated\* from the file .*\.sage' files))

      fi

} complete -F _sagecomp sage }}}

Tips (last edited 2022-04-06 03:09:49 by mkoeppe)