[Date Index]
[Thread Index]
[Author Index]
Re: Algebraic Symbol Manipulation
*To*: mathgroup at smc.vnet.net
*Subject*: [mg54160] Re: [mg54125] Algebraic Symbol Manipulation
*From*: "David Park" <djmp at earthlink.net>
*Date*: Sat, 12 Feb 2005 01:57:10 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
The Mathematica syntax and commands for solving this problem would be as
follows. First, let's define the equation.
eqn = V == 1/3 Pi r^2h;
Notice that eqn is a symbol that stands for the entire equation. It is Set
with =. But in the equation itself we use == for the equal symbol. Then to
solve the equation we write...
hsol = Solve[eqn, h][[1,1]]
h -> (3*V)/(Pi*r^2)
The '[[1,1]]' was added to the Solve statement because there was only a
single solution and it was returned as a List within a List. Generally there
are multiple solutions and multiple variables and that is why Mathematica
returns Lists of solutions. In this case we just picked off the inner
solution.
The solution was returned as a rule with an arrow. It is stored under the
name hsol. You can use hsol to substitute into any expression that contains
h. The substitution is done using '/.'. For example...
3h + h^2 /. hsol
(9*V)/(Pi*r^2) + (9*V^2)/(Pi^2*r^4)
But you might want to define h as a function of V and r. You can do this
with the following...
h[V_, r_] = h /. hsol
(3*V)/(Pi*r^2)
Then for example, if you wanted an expression for the height of right
circular cones with a radius of 2, you could write...
h[V, 2]
(3*V)/(4*Pi)
If you are a beginner at Mathematica it is worthwhile to work through most
of Part I of The Mathematica Book, actually typing in expressions and making
certain they work.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: mattisbusy at gmail.com [mailto:mattisbusy at gmail.com]
To: mathgroup at smc.vnet.net
Hello,
I was wondering how to manipulate Mathematica into solving a problem
such as this:
Solve for h:
V = 1/3(pie)r^2h
I would think you would do:
Solve[{1/3(pie)r^2h},{h}] - although it does not compute the expected
answer. Am I doing this right? Thanks!
Prev by Date:
**Re: Problems with easy simplifications**
Next by Date:
**Re: Problems with easy simplifications**
Previous by thread:
**Re: Algebraic Symbol Manipulation**
Next by thread:
**[Mathematica 5.1] Bug Report - Two numerical values for a same variable**
| |