0
$\begingroup$

How can I get a derivate at the point? I've specifyed a boundary condition for my PDE:

  lb = - c D[u[x, t], x][a, t] + d u[a, t] == gamma

When I present the function as

a = 0;
c = 1; d= 3;
u[x_, t_] = f[x, t] w[x]
f[x_, t_] = E^(-k t) + 1; 
    k = 5;
w[x_] = x^2 Cos[x];

and try to express the right part:

Solve[lb, gamma]

I get

{{gamma -> -(2 (1 + E^(-5 t)) x Cos[x] - (1 + E^(-5 t)) x^2 Sin[
     x])[0, t]}}

So, variables x and t are still free. But I want Mathematica to substitute x=0 , t=t and get {gamma ->0} above.

$\endgroup$
2
  • $\begingroup$ What do you mean substitute x=0? Have you looked at DSolve[]? $\endgroup$
    – Feyre
    Nov 11, 2016 at 14:17
  • $\begingroup$ No, this is no ODE. I'll use gamma gotten above to simulate the solution I've pointed explicitly. I just take a derivate here , nothing more. $\endgroup$ Nov 11, 2016 at 14:20

1 Answer 1

1
$\begingroup$
a = 0;
c = 1;
d = 3;
k = 5;
f[x_, t_] = E^(-k t) + 1;
w[x_] = x^2 Cos[x];
u[x_, t_] = f[x, t] w[x];

I don't understand what you mean by the notation D[u[x, t], x][a, t] in the definition of lb. Since D[u[x, t], x] is not a pure function, it does not take arguments. Assuming that the definition of lb should read

lb = -c D[u[x, t], x] + d u[a, t] == gamma

(*  -2 (1 + E^(-5 t)) x Cos[x] + (1 + E^(-5 t)) x^2 Sin[x] == gamma  *)

soln = Solve[lb, gamma][[1]] // Simplify

(*  {gamma -> E^(-5 t) (1 + E^(5 t)) x (-2 Cos[x] + x Sin[x])}  *)

lb /. soln // Simplify

(*  True  *)

If instead you mean

lb = -c (D[u[x, t], x] /. x -> a) + d u[a, t] == gamma

(*  0 == gamma  *)

Alternatively, you can write the derivative as

lb = -c Derivative[1, 0][u][a, t] + d u[a, t] == gamma

(*  0 == gamma  *)
$\endgroup$
2
  • $\begingroup$ As I understand the question, the last line is what the OP is looking for. $\endgroup$
    – anderstood
    Nov 11, 2016 at 15:10
  • $\begingroup$ Thank you. Replace /. is what I need. $\endgroup$ Nov 11, 2016 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.