Function-call syntax deprecation

28 views
Skip to first unread message

Federico Galetto

unread,
Sep 9, 2021, 4:18:52 PMSep 9
to sage-support
Hello, I get a warning due to function-call syntax deprecation and I don't understand how to fix it despite looking at other similar conversations.

Here is the setup for my code:

t=var('t')
gamma=vector([t,t^2,t^3])
curve=parametric_plot(gamma,(t,-2,2),color='black',radius=0.02)
v=derivative(gamma,t)
T=v/v.norm()
Tp=derivative(T,t)
N=Tp/Tp.norm()
B=T.cross_product(N)

This code creates the plot of a space curve and computes T,N,B which are unit tangent, normal, and binormal vectors. Now I want to create an interactive 3d plot:

def frame(x):
    pT = T(x).plot(start=gamma(x),radius=0.02)
    pN = N(x).plot(color='red',start=gamma(x),radius=0.02)
    pB = B(x).plot(color='green',start=gamma(x),radius=0.02)
    frenet = pT + pN + pB
    whole = frenet + curve
    return whole
a = animate([frame(x) for x in srange(-0.5,1.5,.02)])
a.show()

Although this works, I get the syntax deprecation warning at the line 'a = animate(...'.

Any help is greatly appreciated!
Fred

Matthias Koeppe

unread,
Sep 10, 2021, 12:09:12 AMSep 10
to sage-support
Instead of:
gamma=vector([t,t^2,t^3])
use:
gamma=vector([t,t^2,t^3]).function(t)

Alternatively, keep gamma as is and use gamma(t=x) instead of gamma(x).

Kwankyu

unread,
Sep 10, 2021, 1:05:11 AMSep 10
to sage-support
gamma(t) = vector([t,t^2,t^3])

is a bit simpler.

Federico Galetto

unread,
Sep 10, 2021, 2:33:05 PMSep 10
to sage-support
Thank you both for your suggestions!

The gamma(t)=... solution gave me some other error down the line, while appending .function(t) to the definition of gamma worked but raised errors from later calls to simplify_full(). In the end, replacing x with t=x in the definition of my 'frame' function got rid of all warnings and allowed me to keep everything else in place.

Cheers,
Fred.

Reply all
Reply to author
Forward
0 new messages