From: amzoti on 29 Jul 2010 23:53 On Jul 29, 7:04 pm, "Michael Robinson" <nos...(a)billburg.com> wrote: > "Michael Robinson" <nos...(a)billburg.com> wrote in message > > news:0Ip4o.47779$YX3.18857(a)newsfe18.iad...>I have an expression in x and y (an output line). I have values of x and y > >for which I need to evaluate the expression. How do I input the values and > >command mathematica to evaluate the expression? > > Another problem. > Now mathematica is doing something it shouldn't be doing. > When I put in an expression such as > i = 3 x^2 + 2 y^2 - 4 y + 1 > > it should just reprint the expression on the next line. > > But now it's putting out a numerical expression. > > I've tried using the "clear" command for i, also for x and y, but it just > keeps doing it. Recommend you look at what = means versus := versus others
From: gearhead on 30 Jul 2010 09:27 On Jul 29, 11:52 pm, amzoti <amz...(a)gmail.com> wrote: > On Jul 29, 7:04 pm, "Michael Robinson" <nos...(a)billburg.com> wrote: > > > > > "Michael Robinson" <nos...(a)billburg.com> wrote in message > > >news:0Ip4o.47779$YX3.18857(a)newsfe18.iad...>Ihave an expression in x and y (an output line). I have values of x and y > > >for which I need to evaluate the expression. How do I input the values and > > >command mathematica to evaluate the expression? > > > Another problem. > > Now mathematica is doing something it shouldn't be doing. > > When I put in an expression such as > > i = 3 x^2 + 2 y^2 - 4 y + 1 > > > it should just reprint the expression on the next line. > > > But now it's putting out a numerical expression. > > > I've tried using the "clear" command for i, also for x and y, but it just > > keeps doing it. > > Perhaps what you want if f[x_, y_] := 3 x^2 + 2 y^2 - 4 y + 1 > > Now, you want to plug values in for x and y, for example: > > x=0, y=0 is f[0,0] (shift-enter) > > x = 3, y = 5 is f[3,5] (shift-enter) > > x = 3, y = -11 is f[3,-11] (shift-enter) > > Note that x and y can be Z or R or Q > > Is that what you are looking for? > > Recommendation: read the MMA introduction for basic operations - it > will help a lot. I tried the syntax you recommend and it works. Somebody on craigslist sci forum suggested the form x + y /. {x->a, y->2} and that works too. I couldn't get the clear command to work but for now I can get around that by just shutting mathematica down and reopening it.
From: amzoti on 30 Jul 2010 11:29 On Jul 30, 6:27 am, gearhead <nos...(a)billburg.com> wrote: > On Jul 29, 11:52 pm, amzoti <amz...(a)gmail.com> wrote: > > > > > On Jul 29, 7:04 pm, "Michael Robinson" <nos...(a)billburg.com> wrote: > > > > "Michael Robinson" <nos...(a)billburg.com> wrote in message > > > >news:0Ip4o.47779$YX3.18857(a)newsfe18.iad...>Ihavean expression in x and y (an output line). I have values of x and y > > > >for which I need to evaluate the expression. How do I input the values and > > > >command mathematica to evaluate the expression? > > > > Another problem. > > > Now mathematica is doing something it shouldn't be doing. > > > When I put in an expression such as > > > i = 3 x^2 + 2 y^2 - 4 y + 1 > > > > it should just reprint the expression on the next line. > > > > But now it's putting out a numerical expression. > > > > I've tried using the "clear" command for i, also for x and y, but it just > > > keeps doing it. > > > Perhaps what you want if f[x_, y_] := 3 x^2 + 2 y^2 - 4 y + 1 > > > Now, you want to plug values in for x and y, for example: > > > x=0, y=0 is f[0,0] (shift-enter) > > > x = 3, y = 5 is f[3,5] (shift-enter) > > > x = 3, y = -11 is f[3,-11] (shift-enter) > > > Note that x and y can be Z or R or Q > > > Is that what you are looking for? > > > Recommendation: read the MMA introduction for basic operations - it > > will help a lot. > > I tried the syntax you recommend and it works. > Somebody on craigslist sci forum suggested > the form > x + y /. {x->a, y->2} > and that works too. > I couldn't get the clear command to work but for now I can get around > that by just shutting mathematica down and reopening it. Remove[i] (shift-enter) The method above is called postfix. See: http://reference.wolfram.com/mathematica/tutorial/SpecialWaysToInputExpressions.html Mathematica is an incredible program and allows many methodologies for getting the job done. They have subtle differences and learning those allows you to understand what a wonderful tool this is.
First
|
Prev
|
Pages: 1 2 Prev: JSH: My Twin Peaks Gap equations predict Cleavage effect Next: Tricky Answers |