Re: Converting system of equat

• To: mathgroup@smc.vnet.net
• Subject: [mg10257] Re: Converting system of equat
• From: "Herbert Gintis" <gintis@econs.umass.edu>
• Date: Sat, 3 Jan 1998 05:07:12 -0500
• Organization: University of Massachusetts
• References: <67l8pv\$1mo@smc.vnet.net>

```Times[x] is interpreted as Times[x,1], which just gives x. So there's
your result. You could write
foo[Plus[x_,y_]] := Times[x,y], solving the problem. You may have to set
the attributes for foo to HoldAll so that the Plus is not evaluated.
I'm not sure.

--
Herbert Gintis
Department of Economics           Phone: 413-586-7756 University of
Massachusetts       Fax:   413-586-6014 Amherst, MA 01003
gintis@econs.umass.edu            http://www-unix.oit.umass.edu/~gintis/

Ersek_Ted%PAX1A@mr.nawcad.navy.mil wrote in message
<67l8pv\$1mo@smc.vnet.net>...
>
>Tom James wrote:
> ----------------------------------------- |
>|I have, as a solution to a system of O.D.E.'s, a number of equations
>|with unknowns A, B, C, etc.  I would like Mathematica to write this
>|system in matrix form, i.e., y=M.x, M is a matrix, x is the unknowns.
>|
>
>OK.   M is a matrix, x  is/are  the unknowns. What is y?
>
>Well maybe the following example answers the question.
>
>
>In[1]:=
>soln=DSolve[{z'[x]==-y[x], y'[x]== z[x]+1, y[0]==1, z[0]==0},
>           {y[x], z[x]}, x]
>
>
>Out[1]={{y[x] -> Cos[x] + Sin[x],  z[x] -> -1 + Cos[x] - Sin[x]}}
>
>
>In[2]:=
>m={ y[x],z[x] } /.soln[[1]]
>
>Out[2]=
>{Cos[x]+Sin[x], -1+Cos[x]-Sin[x]}
>
>
>     Ted Ersek
>
>
> id CAA01525; Mon, 22 Dec 1997 02:54:29 -0500
>  (5.67a/IDA-1.5 for <mathgroup@smc.vnet.net>); Mon, 22 Dec 1997
>08:56:56 +0100 From: Gianluca Gorni <gorni@dimi.uniud.it> To:
To: mathgroup@smc.vnet.net
>mathgroup@smc.vnet.net
>
>
>Hello Mathusers!
>
>What about this as a way of changing the head of an expression from a to
>b:
>
>In[1]:= foo[a[x__]]:=b[x];
>
>It seems to work:
>
>In[2]:= foo[a[x1,x2]]
>
>Out[2]= b[x1, x2]
>
>But not if the head is Plus and I want to change it to Times:
>
>In[3]:= foo[Plus[x__]]:=Times[x];
>
>In[4]:= foo[Plus[x1,x2]]
>
>Out[4]= x1 + x2
>
>Anybody can explain this difference?
>
>Cheers,
>              Gianluca Gorni
>
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>Gianluca Gorni
>Universita` di Udine
>Dipartimento di Matematica e Informatica via delle Scienze 208
>I-33100 Udine UD
>Italy
>
>Ph.:(39) (432) 558422    Fax:(39) (432) 558499
>mailto:gorni@dimi.uniud.it
>http://www.dimi.uniud.it
>
>

```

• Prev by Date: Re: Re: PostScript reader (for MAC)
• Next by Date: Ricci version 1.32
• Prev by thread: Re: Re: PostScript reader (for MAC)
• Next by thread: Ricci version 1.32