       Solved: Factor/Simplify set of complex expressions

• To: mathgroup at smc.vnet.net
• Subject: [mg116677] Solved: Factor/Simplify set of complex expressions
• From: Enrique Fernández Perdomo <enrique.fernandez.perdomo at gmail.com>
• Date: Wed, 23 Feb 2011 06:23:38 -0500 (EST)

```Hello all,

Given a function and its derivatives, it is possible to obtain an optimized expression to compute all of them using:
Experimental`OptimizeExpression

Here it is a synthetic example:
z = 1 - Tanh[(y - B[t] Cos[k (x - c t)])/Sqrt[1 + (k B[t] Sin[k (x - c t)])^2]];
res = Table[D[z, {x, i}, {y, j}], {i, 1, 2}, {j, 1, 2}] // Simplify
Experimental`OptimizeExpression[res]

Notice that the call to Simplify takes some time depending on the original function, but if not used the resulting optimized expression would be larger. So, you might omit Simplify or use a simpler function, like:
z = b (1 - f[x, y, t]^2);

Thanks to Oliver Ruebenkoenig.

Best regards,
Enrique=

```

• Prev by Date: Re: outputting C code
• Next by Date: Re: Integral with singularities
• Previous by thread: Re: Rational[a,b] vs Rational[1,2]
• Next by thread: Re: Solved: Factor/Simplify set of complex expressions