Using NDSolve for 2-variables functions ?
- To: mathgroup at smc.vnet.net
- Subject: [mg31040] Using NDSolve for 2-variables functions ?
- From: Florent Saulnier <Florent.Saulnier at college-de-france.fr>
- Date: Fri, 5 Oct 2001 01:22:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello I'm a french user of Mathematica 4.0 Could you please put the following question in the Math Group ? Thanks a lot. Title : Using NDSolve for 2-variables functions ? I'm trying to solve a quasi-linear PDE using the method of characteristics. For this, I need to calculate a function - for instance f[r_,t_] - by NDSolve (I simplified the equation for clarity) and then use it again in another differential equation : Input[1] Clear[f] f[r_,t_]==f[r]/.NDSolve[{f'[u]+u*f[u]====0,f[Sqrt[t]]====t^2},f,{u ,Sqrt[ f[r_,t_]==f[r]/.NDSolve[{f'[u]+u*f[u]====0,f[Sqrt[t]]====t^2},f,{u,Sqrt[t], 10^9}] [[1]][[1]] ... gives the following error messages : NDSolve::ndnl : Endpoint Sqrt[t] in {u,Sqrt[t],1000000000} is not a real number ReplaceAll::reps : {uf[u]+f'[u]====0} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. Output[1] Null (f[r]/.uf[u]+f'[u]====0) What surprises me even more is that if I give the definition of f[r,t] with the sign :==, it gives me the correct result at any given point, with the correct boundary conditions : Input[1] Clear[f] f[r_,t_]:==f[r]/.NDSolve[{f'[u]+u*f[u]====0,f[Sqrt[t]]====t^2},f,{ u,Sqrt f[r_,t_]:==f[r]/.NDSolve[{f'[u]+u*f[u]====0,f[Sqrt[t]]====t^2},f,{u,Sqrt[t] ,10^9} ][[1]][[1]] Out[1] Null= Input[2] f[3,5] Out[2] 3.3834 Input[3] f[2,4] Out[3] 16 The main problem is that I need f[r,t] for a second equation, and of course its resolution cannot be achieved : Input[1] g[t_]==h[t]/.NDSolve[{h'[u]-f[h[u],u]====0,h[1]====1},h,{u,1,10}][ [1]][[1]] ...which gives the same error messages : NDSolve::ndnl : Endpoint Sqrt[t] in {u,Sqrt[t],1000000000} is not a real number ReplaceAll::reps : {uf[u]+f'[u]====0} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. Could you please help me about these problems ? Is there any other instructions or objects I could use for it ? Thanks a lot ! Florent Saulnier