W
William Benson
I have a basic linear equation of this form (Note, parentheses and grouped
terms will not matter):
-25 + 3*X + 15*Y - 4*X^2 + 8*X^2*Y^-2
Note: never this form -25 + 3*X + 15*Y - 4*X^2 (1 - 2 Y^-2)
Can someone please help me build a parsing routine to isolate terms, and
whether they are preceded by a + or a -. I am using two separate arrays
because I later have to work with each term to calculate a derivative.
Negative exponent must be treated differently than a minus sign. ArrTerms
and ArrOps() should look like this at the end of the above exercise, and be
generalizable:
i ArrTerms( i ) ArrOps( i )
1 25 -
2 3*X +
3 15*Y +
4 4*X^2 -
5 8*X^2*Y^-2 +
I'd be very appreciative for help with the required (generalizable) routine.
If I can clarify something, please e-mail me (w b e n s o n 1 @ n y c a p .
r r . c o m) or post here.
Thanks!
terms will not matter):
-25 + 3*X + 15*Y - 4*X^2 + 8*X^2*Y^-2
Note: never this form -25 + 3*X + 15*Y - 4*X^2 (1 - 2 Y^-2)
Can someone please help me build a parsing routine to isolate terms, and
whether they are preceded by a + or a -. I am using two separate arrays
because I later have to work with each term to calculate a derivative.
Negative exponent must be treated differently than a minus sign. ArrTerms
and ArrOps() should look like this at the end of the above exercise, and be
generalizable:
i ArrTerms( i ) ArrOps( i )
1 25 -
2 3*X +
3 15*Y +
4 4*X^2 -
5 8*X^2*Y^-2 +
I'd be very appreciative for help with the required (generalizable) routine.
If I can clarify something, please e-mail me (w b e n s o n 1 @ n y c a p .
r r . c o m) or post here.
Thanks!