Items tagged with diff diff Tagged Items Feed

Hey all,

I want to symbolically differentiate a function and recalculate the result later. Here is what I have tried so far:


restart;

myexp:=dfdb+sthlong

dfdb+sthlong

(1)

b:=<b1(t),b2(t)>;

b := Vector(2, {(1) = b1(t), (2) = b2(t)})

(2)

dfdb:=Physics[diff]~(f(b),b)

dfdb := Vector(2, {(1) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)})), (2) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)}))})

(3)

f:=b->b(1)^2+b(2)

proc (b) options operator, arrow; b(1)^2+b(2) end proc

(4)

eval(myexp);  #actual result

 

 

sthlong+(Vector(2, {(1) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)})), (2) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)}))}))

(5)

dfdb:=Physics[diff]~(f(b),b):

eval(myexp); #expected result

sthlong+(Vector(2, {(1) = 2*b1(t), (2) = 1}))

(6)

 


Download physics_diff.mw

I wonder if this is even possible, or if I missunderstand something. Can you please help me?

 

Thanks

 

Honigmelone

Hello,

 

I'm modeling the simple DC motor system in Maple.
The equations describing the system;

eq1:=J*diff(theta(t),t,t)+b*diff(theta(t),t)=K*i(t):
eq2:=L*diff(i(t),t)+R*i(t)=V(t)-K*diff(theta(t),t):
DCMotor:=[eq1,eq2];

First, I create the system using DiffEquation:

Sys:=DiffEquation(DCMotor,[V(t)],[theta(t)]);

And now I have problem. The input var is V(t) (input voltage) and the output var is theta(t) (position of the rotor).

But I wont to have in output var not position of the rotor but speed of the fotor - diff(theta(t),t)

How to set output var for diff(theta(t),t) (the speed of the motor)?

 

Best

Rariusz

 

Hi

 

I am new to Maple and discovering its features. I was wondering whether it is possible to define a function abstractly, say:

fo:=f(1/x)

and differentiate it, to obtain f'(1/x) (-1/x^2)? Is this possible?

 

Thanks!

Hello :-),

 

How can I differentiate the follwing function:

Cq = Cao*k1*t / [(1+k1*t)*(1+k2*t)]

If want to find the maximum:

dCq/dt = 0

I can solve if of course by hand. The solution is t=1/sqrt(k1*k2)

I tried it with maple, but I got a strange result (see picture). How can I use maple to get the right result?

 

Thank you very much!

 

Dear All

How can we collect coefficient wrt certain differential ration in an expression?

See for detail:


with(PDEtools):

u := a[0]+a[1]*(diff(phi(xi), xi))/phi(xi)

a[0]+a[1]*(diff(phi(xi), xi))/phi(xi)

(1)

-k*(diff(u, `$`(xi, 2)))+alpha*(diff(u, `$`(xi, 3)))

-k*(a[1]*(diff(diff(diff(phi(xi), xi), xi), xi))/phi(xi)-3*a[1]*(diff(diff(phi(xi), xi), xi))*(diff(phi(xi), xi))/phi(xi)^2+2*a[1]*(diff(phi(xi), xi))^3/phi(xi)^3)+alpha*(a[1]*(diff(diff(diff(diff(phi(xi), xi), xi), xi), xi))/phi(xi)-4*a[1]*(diff(diff(diff(phi(xi), xi), xi), xi))*(diff(phi(xi), xi))/phi(xi)^2+12*a[1]*(diff(diff(phi(xi), xi), xi))*(diff(phi(xi), xi))^2/phi(xi)^3-3*a[1]*(diff(diff(phi(xi), xi), xi))^2/phi(xi)^2-6*a[1]*(diff(phi(xi), xi))^4/phi(xi)^4)

(2)

expand(dsubs(diff(phi(xi), `$`(xi, 2)) = -lambda*(diff(phi(xi), xi))-mu*phi(xi), -k*(a[1]*(diff(diff(diff(phi(xi), xi), xi), xi))/phi(xi)-3*a[1]*(diff(diff(phi(xi), xi), xi))*(diff(phi(xi), xi))/phi(xi)^2+2*a[1]*(diff(phi(xi), xi))^3/phi(xi)^3)+alpha*(a[1]*(diff(diff(diff(diff(phi(xi), xi), xi), xi), xi))/phi(xi)-4*a[1]*(diff(diff(diff(phi(xi), xi), xi), xi))*(diff(phi(xi), xi))/phi(xi)^2+12*a[1]*(diff(diff(phi(xi), xi), xi))*(diff(phi(xi), xi))^2/phi(xi)^3-3*a[1]*(diff(diff(phi(xi), xi), xi))^2/phi(xi)^2-6*a[1]*(diff(phi(xi), xi))^4/phi(xi)^4)))

-a[1]*(diff(phi(xi), xi))*alpha*lambda^3/phi(xi)-a[1]*alpha*lambda^2*mu-7*a[1]*(diff(phi(xi), xi))^2*alpha*lambda^2/phi(xi)^2-8*a[1]*(diff(phi(xi), xi))*alpha*lambda*mu/phi(xi)-a[1]*(diff(phi(xi), xi))*k*lambda^2/phi(xi)-2*a[1]*alpha*mu^2-a[1]*k*lambda*mu-12*a[1]*(diff(phi(xi), xi))^3*alpha*lambda/phi(xi)^3-8*a[1]*(diff(phi(xi), xi))^2*alpha*mu/phi(xi)^2-3*a[1]*(diff(phi(xi), xi))^2*k*lambda/phi(xi)^2-2*a[1]*(diff(phi(xi), xi))*k*mu/phi(xi)-6*a[1]*(diff(phi(xi), xi))^4*alpha/phi(xi)^4-2*a[1]*(diff(phi(xi), xi))^3*k/phi(xi)^3

(3)

How ca extract coefficients of fraction (diff(phi(xi), xi))/phi(xi) in (3) ????


Download Coefficients_of_Fractions.mw

Regards

diff(a(t), t) = diff(a(t), t);
diff(b(t),t) = 0;
diff(c(t),t) = -b(t)/a(t);

[diff(rhs(sol[1][2]), a(t)),diff(rhs(sol[1][2]), b(t)),diff(rhs(sol[1][2]), c(t))];
Error, (in VectorCalculus:-diff) invalid input: diff received a(t), which is not valid for its 2nd argument

 

 

question1 := b(t)*(diff(c(t), t))*(diff(a(t), t))+a(t)*(diff(b(t), t))

how to subs(b(t)=0, question1) result in a(t)*(diff(b(t), t)) ?

in fact b(t) = 0 but diff(b(t), t) != 0 

Consider, say, the following third order derivative:

expr := diff(f(x,y),x,y$2);

Does there in Maple exist some built-in functions for extracting from such an expression 1.) the function being differentiated, and 2.) the coordinates being differentiated with respect to? Using op(expr) is of no immediate avail as it returns only a second order derivative (as the first operand), and one of the coordinates being differentiated with respect to (as the second operand).

It is, of course, possible to make ones own function for extracting these two quantities, a crude example being

splitDeriv := proc(expr,coords::expects(list) := [])
   if PDETools:-difforder(expr) > 0 then
      splitDeriv(op(1,expr),[coords[],op(2,expr)])
   else
      expr,coords
   end if
end proc:

for which

splitDeriv(expr);

But it would be much nicer to use built-in functions. And perhaps such functions do exist. If so, I am unable to locate them. Perhaps I am just being stupid, for the problem seems rather elementary.

Dear all

I have problem related to collection of coefficient of differtials in differential expression containing multiple dependent variables and we want to collect coefficient wrt to selected dependent variables. Please see attached Maple file for details.

 


with(PDEtools):

DepVars := [u(x, t), v(x, t), a[1](t), a[2](t), a[3](t), b[1](t), b[2](t), b[3](t), r(x, t), s[1](x, t), p[1](x, t), s[2](x, t), p[2](x, t)]

[u(x, t), v(x, t), a[1](t), a[2](t), a[3](t), b[1](t), b[2](t), b[3](t), r(x, t), s[1](x, t), p[1](x, t), s[2](x, t), p[2](x, t)]

(1)

alias(u = u(x, t), v = v(x, t), a[1] = a[1](t), a[2] = a[2](t), a[3] = a[3](t), b[1] = b[1](t), b[2] = b[2](t), b[3] = b[3](t), r = r(x, t), s[1] = s[1](x, t), p[1] = p[1](x, t), s[2] = s[2](x, t), p[2] = p[2](x, t))

u, v, a[1], a[2], a[3], b[1], b[2], b[3], r, s[1], p[1], s[2], p[2]

(2)

Suppose we differential expression like:

a[1]*(diff(u, x))*s[1]*u-2*a[1]*u*(diff(r, x))*(diff(u, x))+2*a[2]*(diff(v, x))*s[2]*v-2*a[2]*v*(diff(r, x))*(diff(v, x))-(diff(a[3], t))*r*(diff(u, x))/a[3]+diff(p[1], t)+a[3]*(diff(p[1], x, x, x))+(diff(r, t))*(diff(u, x))+(diff(s[1], t))*u-(diff(a[3], t))*s[1]*u/a[3]-s[1]*a[2]*v*(diff(v, x))-(diff(a[3], t))*a[1]*u*(diff(u, x))/a[3]-(diff(a[3], t))*a[2]*v*(diff(v, x))/a[3]-3*(diff(r, x))*p[1]+(diff(a[1], t))*u*(diff(u, x))+(diff(a[2], t))*v*(diff(v, x))+a[2]*(diff(v, x))*p[2]+a[2]*v^2*(diff(s[2], x))+a[2]*v*(diff(p[2], x))+a[1]*u*(diff(p[1], x))+a[1]*(diff(u, x))*p[1]+a[1]*u^2*(diff(s[1], x))+3*a[3]*(diff(s[1], x))*(diff(u, x, x))+3*a[3]*(diff(s[1], x, x))*(diff(u, x))+a[3]*(diff(r, x, x, x))*(diff(u, x))-(diff(a[3], t))*p[1]/a[3]-3*r*(diff(r, x))*(diff(u, x))-3*(diff(r, x))*s[1]*u+a[3]*(diff(s[1], x, x, x))*u+3*a[3]*(diff(r, x, x))*(diff(u, x, x)) = 0

3*a[3]*(diff(diff(r, x), x))*(diff(diff(u, x), x))+3*a[3]*(diff(s[1], x))*(diff(diff(u, x), x))+3*a[3]*(diff(diff(s[1], x), x))*(diff(u, x))+a[3]*(diff(diff(diff(r, x), x), x))*(diff(u, x))+a[3]*(diff(diff(diff(s[1], x), x), x))*u+diff(p[1], t)+(diff(r, t))*(diff(u, x))+(diff(s[1], t))*u-3*(diff(r, x))*p[1]+a[3]*(diff(diff(diff(p[1], x), x), x))-(diff(a[3], t))*a[1]*u*(diff(u, x))/a[3]-(diff(a[3], t))*a[2]*v*(diff(v, x))/a[3]+a[1]*(diff(u, x))*s[1]*u-2*a[1]*u*(diff(r, x))*(diff(u, x))+2*a[2]*(diff(v, x))*s[2]*v-2*a[2]*v*(diff(r, x))*(diff(v, x))-(diff(a[3], t))*r*(diff(u, x))/a[3]-(diff(a[3], t))*s[1]*u/a[3]-s[1]*a[2]*v*(diff(v, x))+(diff(a[1], t))*u*(diff(u, x))+a[1]*u*(diff(p[1], x))+a[2]*v*(diff(p[2], x))+a[2]*v^2*(diff(s[2], x))+a[2]*(diff(v, x))*p[2]+a[1]*(diff(u, x))*p[1]+a[1]*u^2*(diff(s[1], x))-(diff(a[3], t))*p[1]/a[3]-3*r*(diff(r, x))*(diff(u, x))-3*(diff(r, x))*s[1]*u+(diff(a[2], t))*v*(diff(v, x)) = 0

(3)

We can collect coefficients of differential like u[x], u[x, x], v[x], u, vin following manner:

The Procedure

   

 

 

Now how can we collect coefficents with respect to u[x], u[x, x], v[x], u, vso that differential expression (3) appear as
"(......)*u+(.......)*v+(......)*u[x]+(........)*uu[x]+(.........)vv[x]+(........)u[xx]  =0....................."????????""

``


Download Collecting_Coefficients_in_Differential_Expression.mw

Regards

Hey,

I have an expression like this:

a:= b(t)+diff(b(t),t)+diff(b(t),t$2)+diff(b(t),t$3)+...:

 

I want to substitute diff(b(t),t) with b_symbol_diff. I dont know how many more differentials are in the expression.

If I use subs(diff(b(t),t)=b_symbolic_diff,a)

maple also substitutes in diff(b(t),t$2). Because b_symbol_diff is not a function of t the higher order differentials are zero.

Is there a way to tell maple not to substitute those expressions that are enclosed in diff()?

I need this because I want to calculate the Jacobian of a vector and VectorCalculus[Jacobian]() does not accept functions.

Thanks in advance!

Hello all,

I have an ODE system (please see bellow) where my unknowns are S(t) and K(t), all the the other symbols are known parameters. This system, by given the initial values for S and K, that is, S(0)=100 and K(0)=20, I can solve numerically.

sys:= diff(S(t), t) = -eta*K(t)*S(t)/(w*N*(S(t)+K(t))), diff(K(t), t) = eta*K(t)*S(t)/(w*N*(S(t)+K(t)))+S(t)*(-z*eta*alpha*K(t)^2+(-z*eta*alpha*S(t)-(eta*alpha^2*S(t)^2-2*N*C[max]*w*eta*alpha*K(t)+((-N*w+z)*alpha+N*C[max]^2*w*eta)*w*N)*upsilon)*K(t)+N*S(t)*w*alpha*upsilon*(N*w-z))/((K(t)^2*alpha*z+3*K(t)*S(t)*alpha*z+(2*S(t)*z*alpha+upsilon)*S(t))*w*N)

In addition, I have an algebraic equation:

eq1:= -c2 + (K(t2)*S(t2)+w*N*S(t2))*z=0,

where S(t2) and K(t2) are the solutions of my ODE sys in S and K at t=t2. The t2 is unknown time variable. 

My question is: how can I find t2 such that my algebraic equation (eq1) is satisfied.

Thanks in advance,

Dmitry

 

 

I have a pair of linear functions I want to differentiate wrt time. The first line defines the functions, and thesecond a substitution that tells maple that the variables of these linear functions, are themselves functions of time.

F := Vector([p[1]*p[6]*(p[2]-x[1]-x[2])-p[3]*x[1], p[4]*p[6]*(p[2]-x[1]-x[2])-p[5]*x[2]])
timefull := [x[1] = x[1](t), x[2] = x[2](t)]

This line should give the ith derivative

Fdiffi := [diff(subs(timefull, F[1]), t$i), diff(subs(timefull, F[2]), t$i)]

however maple gives me a responce in terms of the pochammer function. Why is this? How do i avoid it?

diff(F(x,F(x)), x);

 

how to differentiate this?

 

(D[1](F))(x, F(x))+(D[2](F))(x, F(x))*(diff(F(x), x))

 

how to find (D[1](F))(x, F(x)) and (D[2](F))(x, F(x)) ?

 

i guess need define new calculus for two variables

Limit((F(x+h,F(x+h)) - F(x,F(x)))/h, h = 0);

Limit((F(x+h,F(x)) - F(x,F(x)))/h, h = 0);
Limit((F(x,F(x+h)) - F(x,F(x)))/h, h = 0);

Limit((F(x+h,F(x,y)) - F(x,F(x,y)))/h, h = 0);
Limit((F(x,F(x+h,y)) - F(x,F(x,y)))/h, h = 0);

 

if inside F(x) is F(x,y)

it seems need to find the basic definition of F(x,y) first

if i define F(x,y) as

F := (x,y) -> min(x,y)/max(x,y);

 

i may be wrong, how to differentiate correctly?

Hello everyone!

Suppose, we have a differential polynomial

P := u(x) + (D@@2)(u)(x)

Given this, I am looking for a procedure which gives coefficients depending on the order given as input, for example, lets say, procedure name is fun_coeff which depends on two parameters, original polynomial P and the order n, then

fun_coeff(P, 3) should give [1, 0, 1, 0]

where each entry corresponds to the coeff of

 [u(x), (D@@1)(u)(x), (D@@2)(u)(x), (D@@3)(u)(x)]

in the polynomial, similarly

fun_coeff(P,4) should give [1, 0, 1, 0, 0]

corresponding to

 [u(x), (D@@1)(u)(x), (D@@2)(u)(x), (D@@3)(u)(x), (D@@4)(u)(x) ]

Thank you all for your time :)

I have functions like

g := (y, t)->sin(y(t))

diff(g(y, t), t) # ok

How to determine the derivative below with maple :

diff(g(y, t), y(t))

Thanks

1 2 3 4 5 6 7 Last Page 1 of 14