Evaluating an algebraic formula in calc-mode

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Evaluating an algebraic formula in calc-mode

Narendra Joshi
Hi,

I am trying to enter an algebraic formula/expression and specify values
for symbols used in the formula and check the value of the expression.

For example,
For 0.01 * (n^2 + 4n + 100), I want to find its value at n = 100, 200.
I have tried looking at the manual but couldn't find anything
quickly. There is `a S` to solve for a symbol but it doesn't do what I
have described here. If you have used calc and can help, it would be
great!

Best,
--
narendraj9

Reply | Threaded
Open this post in threaded view
|

Re: Evaluating an algebraic formula in calc-mode

Nick Dokos-3
Narendra Joshi <[hidden email]> writes:

> Hi,
>
> I am trying to enter an algebraic formula/expression and specify values
> for symbols used in the formula and check the value of the expression.
>
> For example,
> For 0.01 * (n^2 + 4n + 100), I want to find its value at n = 100, 200.
> I have tried looking at the manual but couldn't find anything
> quickly. There is `a S` to solve for a symbol but it doesn't do what I
> have described here. If you have used calc and can help, it would be
> great!
>

You need to store a value in a variable with "s s" and then evaluate the formula
with "=".

E.g.:
      '0.01*(n^2 + 4*n + 100) RET        enters the formula on the stack
      SP                                 duplicates it
      100 s s n                          puts 100 at the top of the stack and assigns it to "n".
      DEL                                get rid of the 100 at the top of the stack
      =                                  evaluate the formula
      TAB                                rotate the stack to move the value above the formula
     
Repeat steps 2 through 6 with different values for n.

HTH.
--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler