MathGroup Archive 1998

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

Search the Archive

RE: A simple bug..



If you want to replace h PERMANENTLY use h=6 See also help for Set,
Replace and ReplaceAll.

Hope this helps,


**************************************** Jean-Marie THOMAS
Conseil et Audit en Inginierie de Calcul Strasbourg, France
****************************************

-----Original Message-----
From: Dr. Jagannatha Rao [mailto:rao@supermod.egr.uh.edu] To:
mathgroup@smc.vnet.net
Subject: [mg12029] [mg11985] A simple bug..


I seem to have come across this  simple and reproducible bug :

The error is in the last line of this post (the others are simply
reproducing my previous steps) where "h" is not being replaced.....

Mathematica 3.0 for NEXTSTEP Intel
Copyright 1988-97 Wolfram Research, Inc.
 -- Motif graphics initialized --

In[1]:= phi={
                1 - 3 (x/h)^2 + 2 (x/h)^3,
                -x(1-x/h)^2,
                3(x/h)^2 - 2 (x/h)^3,
                -x( (x/h)^2 - (x/h))}

                2      3                    2      3               2
             3 x    2 x            x 2   3 x    2 x          x    x
Out[1]= {1 - ---- + ----, -(x (1 - -) ), ---- - ----, -(x (-(-) + --))}
               2      3            h       2      3          h     2
              h      h                    h      h                h

In[2]:= k1[i_,j_]:=
        Integrate[
                ( e in
                                         D[phi[[i]],{x,2}]
D[phi[[j]],{x,2}]
                ), {x,0,h}]                         Syntax::newl: The
newline character after "             ( e in  "
     is understood as a multiplication operator.


In[3]:= k1matrix=Table[k1[i,j], {i,4},{j,4}]

          12 e in  -6 e in  -12 e in  -6 e in Out[3]= {{-------,
-------, --------, -------},
             3        2         3        2
            h        h         h        h

      -6 e in  4 e in  6 e in  2 e in    -12 e in  6 e in  12 e in  6 e in
>    {-------, ------, ------, ------}, {--------, ------, -------,
------},
         2       h        2      h           3        2       3        2
        h                h                  h        h       h        h

      -6 e in  2 e in  6 e in  4 e in
>    {-------, ------, ------, ------}}
         2       h        2      h
        h                h

In[4]:= k1matrix=Table[k1[i,j], {i,4},{j,4}] /. h->6

          e in  -(e in)  -(e in)  -(e in)    -(e in)  2 e in  e in  e in
Out[4]= {{----, -------, -------, -------}, {-------, ------, ----,
----},
           18      6       18        6          6       3      6     3

      -(e in)  e in  e in  e in    -(e in)  e in  e in  2 e in
>    {-------, ----, ----, ----}, {-------, ----, ----, ------}}
        18      6     18    6         6      3     6      3

In[5]:= k1matrix=Table[k1[i,j], {i,4},{j,4}] /. e*in -> 10^6

          12000000  -6000000  -12000000  -6000000 Out[5]= {{--------,
--------, ---------, --------},
              3         2         3          2
             h         h         h          h

      -6000000  4000000  6000000  2000000
>    {--------, -------, -------, -------},
          2        h        2        h
         h                 h

      -12000000  6000000  12000000  6000000
>    {---------, -------, --------, -------},
          3         2         3        2
         h         h         h        h

      -6000000  2000000  6000000  4000000
>    {--------, -------, -------, -------}}
          2        h        2        h
         h                 h

In[6]:= k1matrix=Table[k1[i,j], {i,4},{j,4}] /. {h->6, e*in ->10^6}

          12000000  -6000000  -12000000  -6000000 Out[6]= {{--------,
--------, ---------, --------},
              3         2         3          2
             h         h         h          h

      -6000000  4000000  6000000  2000000
>    {--------, -------, -------, -------},
          2        h        2        h
         h                 h

      -12000000  6000000  12000000  6000000
>    {---------, -------, --------, -------},
          3         2         3        2
         h         h         h        h

      -6000000  2000000  6000000  4000000
>    {--------, -------, -------, -------}}
          2        h        2        h
         h                 h


In[7]:=

--
Jagannatha Rao				E-mail:rao@uh.edu
Associate Professor
Department of Mechanical Engineering    Tel   :(713) 743-4535 University
of Houston                   Fax   :(713) 743-4503 Houston, TX
77204-4792





  • Prev by Date: RE: calculation
  • Next by Date: Q. about Solve as applied to vector equations
  • Prev by thread: A simple bug..
  • Next by thread: Re: A simple bug..