Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11750 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-09-15 07:45 +0000 |
| Last post | 2012-09-15 07:45 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Substitute variable name for value (reverse of simplification) Bob Hanlon <hanlonr357@gmail.com> - 2012-09-15 07:45 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-09-15 07:45 +0000 |
| Subject | Re: Substitute variable name for value (reverse of simplification) |
| Message-ID | <k31blv$mnt$1@smc.vnet.net> |
Clear[var1]
var2 = 189*a^3;
Simplify[var2, var1 == 3*a]
7 var1^3
var2 /. a -> var1/3
7 var1^3
var2 /. Solve[var1 == 3*a, a][[1]]
7 var1^3
Bob Hanlon
On Fri, Sep 14, 2012 at 12:21 AM, <mr.hagak@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?
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web