Implementing finite element basis functions in Mma

*To*: mathgroup at smc.vnet.net*Subject*: [mg7093] Implementing finite element basis functions in Mma*From*: jost at no-junk-mail.fr (Christian Jost)*Date*: Wed, 7 May 1997 01:58:17 -0400 (EDT)*Organization*: Universite Paris-Sud XI*Sender*: owner-wri-mathgroup at wolfram.com

I try to test out a finite element algorithm in Mathematica, where the basis functions phi_i for a given vector of numbers {x1,x2,...xn} with x1<x2<..<xn are piecewise linear and phi_i(xj) = delta(i,j) (kronecker symbol). The function below returns the value of the i-th basis function at number t, but the way I implemented it makes symbolic integration (for example the integral of phi_i * phi_j or D[phi_i,x]*phi_j) impossible. Any ideas how I have to write the basis functions to maintain the symbolic calculus? Thanks for your interest, Christian. ps: sorry if you have read this before, but our server had some problems so I could not verify if the original post made it to the net. numberQ[x_] := NumberQ[N[x]] BasisFunctions[i_Integer, t_Real,timeValue:{_?numberQ..}] := Module[{posOfT,sublist,len,value}, len = Length[timeValue]; If[Length[(sublist= Position[(# < t)& /@timeValue,False])] > 0, posOfT = sublist[[1,1]];, posOfT = 0;]; Which[t<timeValue[[1]], (* beginning of which*) value = 0.0, t>timeValue[[len]], 0.0, posOfT == i, (t-timeValue[[posOfT-1]])/(timeValue[[posOfT]]-timeValue[[posOfT-1]]), posOfT == i+1, (timeValue[[posOfT]]-t)/(timeValue[[posOfT]]-timeValue[[posOfT-1]]), True, 0.0 ] (* end of which *) ] -- ********************************************************************* Christian Jost, Université Paris-Sud XI, Orsay, France Please don't send any junk mail or advertisements. For personal mail please send to: Christian.Jost at epc.u-psud.fr