Symbolics, evaluate expression, but not all the way?

I have an expression of the form

using Symbolics
@variables x
V1 = cosh(x+1) + sinh(x + 1)
V2 = sinh(x - 1)

Somehow I would like to evaluate this expressions at 0, but I would like for it too look like

V1 = cosh(1) + sinh(1)
V2 = -sinh(1)

What would be even better would be to introduce new variables, so that cosh(1) = var1 and sinh(1)=var2

I have too many of this expressions and doing it manually sounds like a pain.

Any idea on how to do this?

You could try to basically do substitute but change the walk so it’s not recursive.

1 Like