Re: Unevaluated values of a[[i]]+b[[j]]
- To: mathgroup at smc.vnet.net
- Subject: [mg65235] Re: [mg65211] Unevaluated values of a[[i]]+b[[j]]
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 19 Mar 2006 03:19:12 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Alexandre,
For low level controlled evaluation in steps you could use the
ExpressionManipulation package from my web site below.
Needs["Algebra`ExpressionManipulation`"]
a = {3, 4, 4};
b = {4, 3, 8};
To keep the output in the posting short I will just evaluate a single
composite case from your examples, perhaps with more detail than you might
want. The HoldForm header, of course, does not display in the actual output.
HoldForm[a[[i]] + b[[j]] + a[[i]]/b[[j]]]
% /. {i -> 1, j -> 3}
% // EvaluateAtPattern[a | b]
% // EvaluateAtPattern[Part[__]]
% // ReleaseHold
HoldForm[a[[i]] + b[[j]] + a[[i]]/b[[j]]]
HoldForm[a[[1]] + b[[3]] + a[[1]]/b[[3]]]
HoldForm[{3, 4, 4}[[1]] + {4, 3, 8}[[3]] +
{3, 4, 4}[[1]]/{4, 3, 8}[[3]]]
HoldForm[3 + 8 + 3/8]
91/8
The EvaluateAtPattern command allows you to evaluate a held expression at
specific patterns. There is also an EvaluateAtPosition command that allows
evaluation at specific positions.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Alexandre Costa [mailto:amscosta at uem.br]
To: mathgroup at smc.vnet.net
Dear group,
Suppose a have a = {3,4,4} and b = {4,3,8}.
I want to see the Unevaluated numerics values of a[[i]]*b[[j]],
a[[i]]+b[[j]], a[[i]]/b[[j]], a[[i]] - b[[j]].
The NonCommutativeMultiply operator (**) solves the case of a[[i]]*b[[j]].
But suppose I want to extend that NonCommutativeMultiply operator (**) to
others operations: +, -, / , i.e., see the Unevaluated numeric values of
a[[i]]+b[[j]], a[[i]]/b[[j]], a[[i]] - b[[j]]. Does anybody have a clue
how to do this ?
Suppose I have the expression for the roots of the quadratic equation: -
b[[index]]^2 + Sqrt[delta]/2*a[[index]]
How can I see at once all the numeric values unevaluated on that expression.
In short words, I have lenghtly expressions(with sums,subtraction,divisions
and multiplications and powers) and I want to check each numeric value of
each term in the original unevaluated formula containing elements such as
a[[index]] .
I was thinking in a operator or function to solve all this issue.
Any help is very welcome,
Thanks,
Alex