       Re: Simplifying=> Sqrt[Meter^2/Second^2]

• To: mathgroup at smc.vnet.net
• Subject: [mg3005] Re: Simplifying=> Sqrt[Meter^2/Second^2]
• From: BobHanlon at aol.com
• Date: Mon, 22 Jan 1996 03:05:41 -0500

```In:=
y = Sqrt[x^2 Meter^2/Second^2]

Out=
2  2
Meter  x
Sqrt[---------]
2
Second

PowerExpand will handle this:

In:=
y // PowerExpand

Out=
Meter x
-------
Second

However, there are situations where you may not want PowerExpand
to apply to other elements of the expression.  Consequently, you
may want to teach Mathematica how to handle the square root of the
square of a positive number:

In:=
Unprotect[Sqrt];
Sqrt/: Sqrt[x_^2    /; Positive[x] == True] := x;
Sqrt/: Sqrt[z_/x_^2 /; Positive[x] == True] :=
Sqrt[z]/x; (* must precede next definition *)
Sqrt/: Sqrt[z_ x_^2 /; Positive[x] == True] :=
x Sqrt[z];
Protect[Sqrt];

In:=
Unprotect[Second];
Meter/:  Positive[Meter]  = True;
Second/: Positive[Second] = True;
Protect[Second];

In:=
Sqrt[Meter^2/Second^2]

Out=
Meter
------
Second

In:=
Sqrt[x Meter^2/Second^2]

Out=
Meter Sqrt[x]
-------------
Second

Note that the definitions are not applied retroactively:

In:=
y

Out=
2  2
Meter  x
Sqrt[---------]
2
Second

Mathematica does not try to recompute the Sqrt so it does not
apply the new definitions.

> From: justin at fns.net
To: mathgroup at smc.vnet.net
> Newsgroups: comp.soft-sys.math.mathematica
> Subject: Simplifying=> Sqrt[Meter^2/Second^2]
> Date: 18 Jan 1996 07:31:07 GMT
>
> Does anyone know if mathematica can be "taught" that an
> expression of the Sqrt[Meter^2/Second^2] is equivalent to and should
> be simplified to Meter/Second?
>
> Thanks in Advance
>    Justin at fns.net
>    UF Mechanical Engineering

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Cross sections of 3D figures
• Next by Date: Cross sections of 3D figures
• Previous by thread: Cross sections of 3D figures
• Next by thread: Re: Simplifying=> Sqrt[Meter^2/Second^2]