Ask Your Question
0

Tracing a graph in sagemath

asked 2020-02-28 11:38:53 +0200

gg gravatar image

updated 2020-02-28 11:40:01 +0200

So far my journey into the math world, I have relied on TI-83 calculator a lot to make graphs (as well as trace them).

As far as I know, I can only plot a graph with sagemath. Is there any way to trace a graph?

edit retag flag offensive close merge delete

Comments

What do you mean by "trace"ing a graph ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-02-28 12:02:55 +0200 )edit

Graph Trace lets you move a trace cursor over the points of a graph or plot and displays value information. On TI calculators there a button labeled TRACE, that does just that.

gg gravatar imagegg ( 2020-02-28 12:05:06 +0200 )edit
1

This is to which @gg refers, I think.

Juanjo gravatar imageJuanjo ( 2020-02-28 12:25:20 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-02-28 12:15:00 +0200

Juanjo gravatar image

updated 2020-02-28 12:21:55 +0200

You can construct an interactive graph with a slider to trace the plotted function. As a proof of concept, you can check the interact given in this SageMath Cell. For the sake of completeness, I copy here the corresponding code:

f(x) = sin(2*x)-3*cos(x)
xmin = -2*pi
xmax = 4*pi
@interact
def _(xx=slider(xmin,xmax,default=xmin,label="x"), 
      trace=checkbox(default=False,label="Trace")):
    p = plot(f(x), (x,xmin,xmax), color="green")
    if trace:
        p += text(r"$({0:f},{1:f})$".format(float(xx),float(f(xx))),(xx,f(xx)), 
                  color="black", vertical_alignment="top")
        p += point((xx,f(xx)), color="red", size=30)
    show(p)
edit flag offensive delete link more

Comments

Nice ! Bravo !

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-02-28 22:57:27 +0200 )edit

Thank you!

Juanjo gravatar imageJuanjo ( 2020-02-28 23:35:22 +0200 )edit

That's quite nice, but still crude compared to TI

gg gravatar imagegg ( 2020-02-29 07:31:39 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-02-28 11:38:53 +0200

Seen: 294 times

Last updated: Feb 28 '20