MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: mapping of function revisited

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69983] Re: [mg69923] mapping of function revisited
  • From: gardyloo <gardyloo at mail.wsu.edu>
  • Date: Thu, 28 Sep 2006 06:18:05 -0400 (EDT)

Use replacements?

exp1/.{x->Sin[x], z->Sin[z]}

   I think that'll do what you want.

               Curtis O.

dimmechan at yahoo.com wrote:
> Searching a little more I found one more alternative
>
> exp1 = x^3 + (1 + z)^2;
>
> MapAt[Sin, exp1, Flatten[(Position[exp1, #1] & ) /@ Cases[exp1, _?(
> !NumberQ[#1] & ), {-1}], 1]]
> Sin[x]^3 + (1 + Sin[z])^2
>
> Are there any other alternatives? Especially with proper pattern
> matching?
>
> Thinking a little harder I consider the following pure function
>
> g = TrueQ[First[ToCharacterCode[ToString[p]]] <
> First[ToCharacterCode[ToString[#1]]] <
> First[ToCharacterCode[ToString[z]]]] & ;
>
> Then
>
> MapAt[Sin, exp1, Flatten[(Position[exp1, #1] & ) /@ Cases[exp1, _?(
> !NumberQ[#1] && g[#1] & ), {-1}], 1]]
> (1 + z)^2 + Sin[x]^3
>
> Is it possible to obtain the previous result more compactly?
>
> Thanks
>
>
>   

-- 
==========================================================
Curtis Osterhoudt          
gardyloo at mail.remove_this.wsu.and_this.edu
PGP Key ID: 0x088E6D7A
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================


  • Prev by Date: Re: equation question
  • Next by Date: RE: conversion to InputForm without spaces
  • Previous by thread: mapping of function revisited
  • Next by thread: Re: mapping of function revisited