# Use InterpolatingFunction in differential equations involving derivatives and integrals of the InterpolatingFunction [duplicate]

I solved a problem of solid mechanics, 11 unknown components of displacement functions, i.e., ut0[x, y], wt0[x, y], wc0[x, y], .... NDSolve gives me results in the form of InterpolatingFunction, e.g.:

ut0[x, y] -> InterpolatingFunction[{{0., 0.02}, {0., 0.02}}, <>][x, y]
wt0[x, y] -> InterpolatingFunction[{{0., 0.02}, {0., 0.02}}, <>][x, y]


Now, my aim is to use the value of ut0[x, y] and wt0[x,y] in the main displacement equation to evaluate the displacement field, which is of the form:

ut[x_, y_, z_] = ut0[x, y] - (z)(Derivative[wt0[x, y], x]);


I'm new to Mathematica, so I don't know, how to do it. If at all NDSolve has given me is an instance of InterpolationFunction as a polynomial in x and y, it would be easy to use them in other differential equations.

I've spent a lot of time on this website but couldn't help myself.

## marked as duplicate by xzczd differential-equations StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 26 '18 at 5:52

• "@" won't remind people that didn't show up in the comment. For more information check this post: meta.stackexchange.com/a/43020/284701 – xzczd Dec 26 '18 at 5:54

Try

Clear[ut0,wt0];
{ut0,wt0}=NDSolveValue[...,{ut0,wt0},...]


This gives pure function interpolation objects which can be substituted directly in the differential/integral equation!

Or alternativly use NDSolve (as you probably did?) NDSolve[...,{ut0(*[t]*),wt0(*[t]*)},...] without arguments (*[t]*)

example

Your solution is, if you use NDSolve or NDSolveValue as proposed, something like

sol = {ut0 -> Interpolation[RandomReal[{0, 1}, {10, 3 } ] ], wt0 -> Interpolation[RandomReal[{0, 1}, {10, 3 } ] ]}
(*{ut0 -> InterpolatingFunction[{{0.0356158, 0.948513}, {0.13116,0.819281}}, <>],
wt0 -> InterpolatingFunction[{{0.0672057, 0.977207}, {0.0017383,0.98284}}, <>]}*)


Two interpolation objects without arguments which can be substituted in the differential expression

ut0[x, y] - (z) (Derivative[wt0[x, y], x]) /. sol
(*-z Derivative[InterpolatingFunction[{{0.0672057, 0.977207},{0.0017383, 0.98284}}, <>][x, y], x] +
InterpolatingFunction[{{0.0356158, 0.948513}, {0.13116,0.819281}}, <>][x, y]*)


That's it.

• Lists {wt[x,y],u0t[x,y],..,..,..,..,..,..,..,..,..} and {{wt[x,y]->InterpolatingFunction[{{0.,0.02},{0.,0.02}},{5,4225,0,{1281,0},{3,3},0,0,0,0,Indeterminate&,{},{},False},{<<1>>},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,<<10>>,7.75909*10^-12,7.64796*10^-12,7.31761*10^-12,6.77712*10^-12,6.0418*10^-12,5.13349*10^-12,4.08163*10^-12,2.92745*10^-12,1.73251*10^-12,6.28647*10^-13,0.,0.,1.67508*10^-12,4.10761*10^-12,6.66591*10^-12,9.11237*10^-12,1.13301*10^-11,1.32413*10^-11,1.47873*10^-11,<<1231>>},{Automatic}][x,y],<<9>>,<<1>>}} are not the same shape. – user2718740 Dec 25 '18 at 9:40
• ??? It would be very helpful if you provide your Mathematica code. Because of missing code my answer only describes the solution idea, not usable code! – Ulrich Neumann Dec 25 '18 at 9:50
• Here is the file link Link – user2718740 Dec 25 '18 at 10:07
• Sorry I cannot acces the link. Look at my edited answer... – Ulrich Neumann Dec 25 '18 at 10:17
• Thanks a lot, Let me give it a try! – user2718740 Dec 25 '18 at 10:23