Ask Your Question

Display symbolic expressions without expansion

asked 2016-03-07 21:12:02 +0200

Liang gravatar image

updated 2016-03-07 21:21:41 +0200

I'm trying to write symbolic expressions with many intermediate variables. When I use the "show" function to display the final symbolic expression, it always shows the expression with the intermediate variables fully expanded. How can I show the final expression in terms of intermediate variables? Here is a simplified example:

cc=matrix(SR, 3, 3, t)


With the above code, the output would be

\begin{equation} Q=e^{3t} \end{equation}

How can I generate an output as \begin{equation} Q=e^{I1} \end{equation}

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-07 22:04:22 +0200

tmonteil gravatar image

updated 2016-03-07 22:16:14 +0200

The problem here is that I1 is a Python name whose value is the symbolic expression 3*t, so they are not of the same nature at all, and the symbolic system of Sage is not able to make symbolic expressions with arbitrary Sage objects while keeping the information of their name and meaning (e.g. the log of a graph named G).

An unsatisfactory solution to your problem would be, if it is only about printing, to define I1 as a symbol (independenly of its meaning):

sage: var('I1')
sage: Q=exp(I1)
sage: show(Q)

It is not clear to me what you would like to achieve, but i am not sure you can expect more.

edit flag offensive delete link more


Thank you for the suggestion. What I want to achieve is to have a "normal" symbolic expression that can be displayed in an easily readable form. Normal here means it can be differentiated or integrated etc. My final expression involves many very complicated functions of the matrix "cc" and displaying with all those functions fully expanded would make the final outcome almost impossible for human to understand.

Liang gravatar imageLiang ( 2016-03-08 00:44:28 +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


Asked: 2016-03-07 21:12:02 +0200

Seen: 478 times

Last updated: Mar 07 '16