Help wnated: how to use )trace

31 views
Skip to first unread message

Ralf Hemmecke

unread,
Feb 4, 2022, 1:45:48 AM2/4/22
to fricas-devel
I have programmed a function f in some package P, how exactly can I
trace that function. In my case

)trace f

does not work.

(167) -> cuspToMatrix(cusp(0,1))

+0 - 1+
(167) | |
+1 0 +

(168) -> )trace cuspToMatrix
cuspToMatrix is not a function

Nothing is traced now.

The description of ")help trace" suggests that I should add the complete
internal name. But how to find out?

The only thing I got to work was

(168) -> )trace QEtaModularGammaPackage

Parameterized constructors traced:
QETAMGP

The respective output shows

1<enter QEtaModularGammaPackage.etaCofactorInfinity,85 : 22\#(1

which suggests the internal name, but otherwise the trace information is
much to detailed to be useful in my case. And

(168) -> )trace QEtaModularGammaPackage_.etaCofactorInfinity_,85
QEtaModularGammaPackage.etaCofactorInfinity,85 is not a function

Nothing is traced now.

(168) -> )trace QEtaModularGammaPackage.etaCofactorInfinity_,85

FriCAS does not understand the use of QEtaModularGammaPackage
etaCofactorInfinity,85 here.

So what exactly would I have to put after the )trace command to trace
function f from package/domain/category C?

Thank you in advance.
Ralf

oldk1331

unread,
Feb 4, 2022, 7:02:10 AM2/4/22
to fricas-devel
The usage should be: 

)trace DOMAIN )ops FUNCTION

Does this work in your case?

- Qian

--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/d8f9ffbe-75f2-1298-d9e1-c5c1725f6fee%40hemmecke.org.

Ralf Hemmecke

unread,
Feb 4, 2022, 7:12:25 AM2/4/22
to fricas...@googlegroups.com
(181) -> )trace QEtaModularGammaPackage )ops qetaGrades

Parameterized constructors traced:
QETAMGP

But then I get...

(181) -> sspec := cofactInf(nn, rspec, m, t, idxs)
1<enter QEtaModularGammaPackage.qetaGrades,63 : #(#(22 ((11 -1 1)) NIL)
#(1 ((1 -1 -1)) NIL)
11 6
(#1=(0 . 1) #2=(1 . 11)
#3=(1 . 2))
#(3 4 0 6 0
#(#4=#:G439 #1#
#2# #4#
#4# #4# #3# #4#
#(#(#(#(#(22
((11 -1 1))
NIL)
1 0

#5=#2A((0 -1)

(1 0))

and there are many many MANY more line of output that I am not
interested in. Looks like a description of the package itself.
Would be perfectly enough, if I only see the "enter" and "leave"
messages together with the function name.

")help trace" tells me that ")trace function" should actually do what I
want, but FriCAS seemingly does not let activate it in an obvious way. :-(

Well ")trace" is only for "developers, but even then it should get
better documentation. Best with some working examples.

Ralf

Neven Sajko

unread,
Feb 4, 2022, 7:17:00 AM2/4/22
to fricas-devel
I think I used trace before, and it was like this:

)trace func1
)trace func2
)trace func3

Here func1, func2, func3 are functions that the function you want to
trace calls internally.

Regards,
Neven

Neven Sajko

unread,
Feb 4, 2022, 7:18:17 AM2/4/22
to fricas-devel
Actually, that was for Input functions, not for Spad functions.
Perhaps )trace doesn't work for Spad functions?

Neven Sajko

unread,
Feb 4, 2022, 7:36:40 AM2/4/22
to fricas-devel
I think I managed to do what you want, at least with the version of
Fricas I currently have.

Try this:

(1) -> )trace Matrix(Integer) )ops minColIndex qelt

Packages traced:
Matrix(Integer)
(1) -> m: Matrix(Integer) := [[3]]

1<enter Matrix.minColIndex,9 : #2A((3))
1>exit Matrix.minColIndex,9 : 1
1<enter Matrix.qelt,10 : #2A((3))\1\1
1>exit Matrix.qelt,10 : 3
(1) [3]

(2) -> m + m
1<enter Matrix.minColIndex,9 : #2A((3))
1>exit Matrix.minColIndex,9 : 1
1<enter Matrix.qelt,10 : #2A((3))\1\1
1>exit Matrix.qelt,10 : 3
1<enter Matrix.qelt,10 : #2A((3))\1\1
1>exit Matrix.qelt,10 : 3

1<enter Matrix.minColIndex,9 : #2A((6))
1>exit Matrix.minColIndex,9 : 1
1<enter Matrix.qelt,10 : #2A((6))\1\1
1>exit Matrix.qelt,10 : 6
(2) [6]

As you can see, the requested functions from Matrix(Integer) are traced.

Regards,
Neven

Ralf Hemmecke

unread,
Feb 4, 2022, 7:45:48 AM2/4/22
to fricas...@googlegroups.com
Doesn't work for me.

(181) -> )trace QEtaModularGammaPackage(QEtaConditionsModularGamma0)
)ops qetaGrades

FriCAS does not understand the use of QEtaModularGammaPackage
QEtaConditionsModularGamma0 here.

Ralf

Neven Sajko

unread,
Feb 4, 2022, 9:43:10 AM2/4/22
to fricas-devel
Just a wild guess, perhaps useful: what if you declare a wrapper
package in Spad like so:

QWrapperPackage() == QEtaModularGammaPackage(QEtaConditionsModularGamma0)

And then you could try

)trace QWrapperPackage() )ops qetaGrades

Maybe that could work?

Regards,
Neven

Ralf Hemmecke

unread,
Feb 4, 2022, 11:41:16 AM2/4/22
to fricas...@googlegroups.com
> Just a wild guess, perhaps useful: what if you declare a wrapper
> package in Spad like so:
>
> QWrapperPackage() == QEtaModularGammaPackage(QEtaConditionsModularGamma0)
>
> And then you could try
>
> )trace QWrapperPackage() )ops qetaGrades

I haven't tried and I will not do so, because it would then be easier to
simply add a print statement in front of the "qetaGrades" function and
recompile.

Ralf

oldk1331

unread,
Feb 5, 2022, 6:23:56 PM2/5/22
to fricas-devel
Oops, to avoid "garbage" output, try this instead:

)trace DOMAIN )ops FUNCTION )math

I remembered these extra options are in ")help" documentation...  Looks like it needs improvement.

- Qian

--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages