Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NSolve Question

15 views
Skip to first unread message

Hagwood, Charles R

unread,
May 21, 2013, 12:03:09 AM5/21/13
to

I have a known function f[x,y] and I want to solve the differential
equation (1) for v[t], using NSolve

partial [f(v[t],v'[t])/partial x +(d/dt)[partial f(v[t],v'[t])/partial y =0 (1)

where v'[t] = derivative of v[t] with respect to t.

I did a test to set up (1). I let

f[x_,y_]:=x^2+y^3

v[t]:=Sin[t]

g1[x_,y_]:=partial f(x,y)/partial x

g2[x_,y_]:=partial f(x,y)/partial y

g3[t_]:=g1[v[t],v'[t]]+D[g2[v[t],v'[t]],t]

and asked Mathematica to evaluate

g3[t]

but, Mathematica gives an error. Thanks for the help

Charles



daniel.l...@gmail.com

unread,
May 23, 2013, 3:16:19 AM5/23/13
to
On Monday, May 20, 2013 11:03:09 PM UTC-5, Hagwood, Charles R wrote:
> I have a known function f[x,y] and I want to solve the differential
>
> equation (1) for v[t], using NSolve
>
> partial [f(v[t],v'[t])/partial x +(d/dt)[partial f(v[t],v'[t])/partial y=0 (1)
>
> where v'[t] = derivative of v[t] with respect to t.
>
> I did a test to set up (1). I let
>
> f[x_,y_]:=x^2+y^3
>
> v[t]:=Sin[t]
>
> g1[x_,y_]:=partial f(x,y)/partial x
>
> g2[x_,y_]:=partial f(x,y)/partial y
>
> g3[t_]:=g1[v[t],v'[t]]+D[g2[v[t],v'[t]],t]
>
> and asked Mathematica to evaluate
>
> g3[t]
>
> but, Mathematica gives an error. Thanks for the help
>
> Charles

Hard to know exactly what you did because there is some traditional form, I guess, in what you show. My guess is the issue is in the definition of v[t_], wherein the pattern underbar was omitted. That would mess up the definition in a way that would make g3[t] give a bad result.

Here is code that seems to work.

f[x_,y_] := x^2+y^3
v[t_] := Sin[t]
g1[x_,y_] := D[f[x,y],x]
g2[x_,y_] := D[f[x,y],y]
g3[t_] := g1[v[t],v'[t]]+D[g2[v[t],v'[t]],t]

Then g3[t] gives

Out[18]= 2 Sin[t] - 6 Cos[t] Sin[t]

Daniel Lichtblau
Wolfram Research


0 new messages