# can sage be made to do this algebra?

Enneper's wire lies on an ellipsoid. I want to prove the curvature vector of Enneper's wire always points inward (never tangent to the ellipsoid). The plan is to show that the dot product of the curvature vector with the inward normal to the ellipse is strictly positive.

So I start like this:

```
R,t = var('R,t')
X = vector((R * cos(t) - (1/3)* R^3 * cos(3*t),
- R * sin(t) - (1/3) *R^3 * sin(3*t),
R^2 *cos(2*t)))
Xtheta = X.diff(t)
T = 1/(abs(Xtheta)) * Xtheta # unit tangent
kappavector = T.diff(t)
EllipsoidNormal = vector((-2*R*cos(t) + (2/3)*R^3*cos(3*t),
2*R*sin(t) + (2/3)*R^3 * sin(3*t),-(4/3)*R^2*cos(2*t)))
test = EllipsoidNormal.dot_product(kappavector).trig_simplify()
print(test)
```

So far so good.

In general it is difficult to get Sage to do something to PART of a formula.
For example in sin(4*t) + sin(2*t), get Sage to apply a double angle formula to sin(4*t) so
everything comes out in trig functions of 2*t.

You should format your code: Edit your message, select the code, and click the "code" button (the one made of 6 bits).

The originally posted code gave a negative result due to an extra minus sign.

The image of the results came from the code without that minus sign, so it's positive. Thanks for pointing out how to include code and images. Putting assumptions in doesn't make any difference (I did have some in but deleted them for simplicity). So the answer is, to simplify subexpressions you can cut and paste them, simplify them separately, then use substitution and a second cut-and-paste to get them substituted back in. Fine, if you are working interactively, but that doesn't work in a script. Can anyone give a script that starts with sin(4

t) + sin(2t) and produces a result that is trig functions of 2*t without pre-calculating the answer (either by hand or in Sage)?