Message Boards Message Boards

0
|
1756 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Composite function does not work as expected

Posted 1 year ago

I try to do the Example 5.2.3. provided here as follows:

In[252]:= (*
Example 5.2.3.
*)
Clear[p, x];
B = {1 - x, x + 3 x^2, 2 - x^2}
P = B // CoefficientArrays[#, x] & // Normal // Flatten // 
  ArrayReshape[#, {Length[B], Length[B]}] &

T1[p_] := (p /. p -> 0 ) (1 + x^2) + (p /. p -> 1) x
Tpx = T1 /@ B // Simplify


Out[253]= {1 - x, x + 3 x^2, 2 - x^2}

Out[254]= {{1, 0, 2}, {-1, 1, 0}, {0, 3, -1}}

Out[256]= {x, x, x}

The expected output of the last command should be as follows, but I didn't get it:

enter image description here

Any tips for solving this problem?

Regards,
Zhao

POSTED BY: Hongyi Zhao
2 Replies
Posted 1 year ago

Yes. It works. Are there any other more concise ways to solve my problem here?

POSTED BY: Hongyi Zhao
Posted 1 year ago

Try

T1[p_] := (p /. x -> 0 ) (1 + x^2) + (p /.x -> 1) x
POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract