MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Substitute variable name for value (reverse of simplification)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128095] Re: Substitute variable name for value (reverse of simplification)
  • From: daniel.lichtblau0 at gmail.com
  • Date: Sat, 15 Sep 2012 03:38:19 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k2ub90$ha5$1@smc.vnet.net>

On Thursday, September 13, 2012 11:20:59 PM UTC-5, mr.h... at gmail.com wrote:
> I need this to happen:
> 
> var1 = 3*a
> 
> var2 = 189*a^3
> 
> output = 7*var1^3
> 
> 
> 
> I can do it in very simple and specific equations doing something like
> 
> 
> 
> substituteName2[var_,exp_] := Module[ {},
> 
> 	Solve[p==exp&&"test"==var,{p},{a}]
> 
> ];
> 
> test=3*a;
> 
> substituteName2[test,7*test^3]
> 
> 
> 
> But i need a WAY more general form of that...any ideas?

Check the dox for PolynomialReduce.

In[68]:= PolynomialReduce[189*a^3, var1 - 3*a, {a, var}][[2]]

Out[68]= 7*var1^3

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: primitive root error
  • Next by Date: Re: primitive root error
  • Previous by thread: Re: Substitute variable name for value (reverse of simplification)
  • Next by thread: primitive root error