Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sagetex work together with pgfplots #1

Open
student-sx opened this issue Apr 23, 2016 · 0 comments
Open

Make sagetex work together with pgfplots #1

student-sx opened this issue Apr 23, 2016 · 0 comments

Comments

@student-sx
Copy link

student-sx commented Apr 23, 2016

It would be useful to provide a way to "export" a function defined in sage such that you can use it with pgfplots directly. There is already a suggestion on stackexchange (http://tex.stackexchange.com/questions/220491/how-to-pass-a-function-defined-in-sagetex-to-pgfplots), where I proposed to have something like a sageraw command which you could use to pass the function as in the example below. Another idea would be to provide a command \expfct(funktion,texcommand) which "saves" the function under the name texcommand such that it is available from the main document for pgfplots.

\documentclass{article}
\usepackage{pgfplots}
\usepackage{sagetex}


\begin{document}

\begin{sagesilent}
  f(x) = 2*sin(x^2)
\end{sagesilent}

$f(x) = \sage{f(x)}$

\begin{center}
  \begin{tikzpicture}
    \begin{axis}[no markers, samples=100]
%      \addplot gnuplot {\sageraw{f(x)}};
      %should be the same as
      \addplot gnuplot {2*sin(x^2)};
    \end{axis}
  \end{tikzpicture}
\end{center}

\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant