dharr

Dr. David Harrington

8235 Reputation

22 Badges

20 years, 341 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

As far as I know, the numerical solver doesn't accept conditions involving integrals.

I'm not sure I understand the question. Since the solution is not unique, you can't choose which solution the numeric solver will get unless you change the way you specify the boundary conditions, say, by specifiying a first derivative at 0 (say D(f)(0)=1 ) and not the boundary condition at infinity. Then each slope you choose will give you a different (correct) solution.

 

Just using dsolve(eq1) gives a complicated answer with too much freedom. Try  ans:=dsolve(eq1,f(0)=0) (I am assuming you wanted a=0), which gives four answers, the f(x)=0 one, the tanh one you want and two others:

f(x) = 0, f(x) = tanh((1/2)*x*2^(1/2)/_C1)*2^(1/2)/_C1, f(x) = -2*tan((x+_C2)*Pi/_C2)*Pi/_C2, f(x) = -2^(2/3)*_C1*(3^(1/2)*AiryAi(1, -(1/2)*2^(2/3)*_C1*x)+AiryBi(1, -(1/2)*2^(2/3)*_C1*x))/(3^(1/2)*AiryAi(-(1/2)*2^(2/3)*_C1*x)+AiryBi(-(1/2)*2^(2/3)*_C1*x))

The limit of the derivative is zero for any _C1:

limit(diff(rhs(ans[2]),x),x=infinity) assuming positive; gives 0

tans:=eval(ans[2],_C1=sqrt(2)); gives f(x)=tanh(x/2) and odetest verifies everything is OK:

odetest(tans, [eq1, f(0) = 0, (D(f))(infinity) = 0, (D(D(f)))(0) = 0]); gives [0,0,0,0]

Using other _C1 values also gives OK solutions.

 

 

ToeplitzMatrix in the LinearAlgebra package can do this

with(LinearAlgebra):
ToeplitzMatrix([0,0,c,b,a,0,0]);
ToeplitzMatrix([0,0,x^2,sin(x),x,0,0]);


msolve doesn't work here, since in modulo 2 arithmetic, 1+1+1=1, which allows x1=1,x2=1,x3=1, etc. If your row and column sums are always going to be 1, then the permutation matrices are the answer, since they have one 1 and the rest zeroes in every row and column. There will be 6 solutions in the 3x3 case. Choose where to put the 1 in the first row (3 choices). For your second row, you can choose any of the two other positions, and then for the third row you must use the last postion, for a total of 3x2=6 possibilities.

If you will be doing other row and column sums, then it is a harder problem.

restart:with(PDEtools):
q:=12*(diff(u(x),x$7))^(3/2)*(diff(u(x),x$2))^3;

q := 12*(diff(u(x), x, x, x, x, x, x, x))^(3/2)*(diff(u(x), x, x))^3

1. To get the non-derivative coefficient (12) of this term

remove(has,q,diff);

12

2. To get the third factor, it is easier to remove the 12 and the 2nd factor. dcoeffs considers the second factor to be part of the coefficient, presumably because it deals only with polynomials of derivatives, and the second factor has a non-integral degree

q2:=dcoeffs(q,u(x));
q3:=q/q2;

q2 := 12*(diff(u(x), x, x, x, x, x, x, x))^(3/2)

q3 := (diff(u(x), x, x))^3

 

3. To get the order of this, use difforder

difforder(q3);
difforder(q2);

2

7

 4. To get the degree of this, I would probably use op, but one needs to know that the degree isn't one or treat this case separately

op(2,q3); #dangerous
if type(q3,`^`) then op(2,q3) else 1 end if;

3

3

 

shift-enter inserts a line without the arrow prompt appearing.

use display to combine the two plots, each with their own ranges.

with(plots):

p1:=plot(f,1..3,color=blue):

p2:=plot(g,-2..1,color=red):

display(p1,p2);

Well to get arccosh(3) without evalf, use arccosh(3.0). But that isn't what you need to solve your plot problem.

F:=(x,y)->x*y;
plot(sin(int(F(x,z), x=arccosh(z)...0)), z=1..2);

produces a plot for me (Maple 10), so there must besomething specific about the functions that you are using.

break is for within loops, and yours is not. I think you want "return" here, for premature exit from the procedure. 

Maple has a command for this. It gives the single solution that Alec found above

d:=diff(y(x),x)*diff(y(x),x$3)-diff(y(x),x$2):

DEtools[polysols](d,y(x));

gives

[y(x) = _C3+_C4*x]

 

Since you want the functions T(x1) and T(y1), you should set these up before the loop, e.g.,

h:=solve(x1*exp (T) -1,T); gives h1:=-ln(x1) and then you can turn it into a function by using unapply

Tx1:=unapply(h,x1);

makes a function that is the same as if you had gone

Tx1:=x1->-ln(x1)

and to use it you do  Tx1(3); to get -ln(3)
 

and now your loop is easier (but I'm not sure what you want to do with y1).

To prevent all lines in the loop being output, end your "end do" with a ":", and then use print to force output of the lines you do want to print, e.g,

for i from 1 to 10 do
 x1:=1*i:
 T1:=Tx1(x1);
 print(T=T1);
 print(y1=3*T1);
end do:

 and you can plot the functions by plot(Tx1(x),x=2..5);

 

Just put the commands in a procedure with no arguments - use print to force output of the individual commands. This can be used with the debugger, e.g.,

dothem:=proc()
   print(plot(x^2,x=0..2));
   print("Yo ho ho");
   DEBUG();
   print(int(sin(x),x=0..Pi));
end proc;

(the last "print" is redundant). To invoke it:

dothem();

I not sure what you mean. You wanted "one time fixed , vary x in a especific range"? But if you want to vary x and t, just use the other form of value (see the help page for pdsolve,numeric)

ut:=sol:-value(u(x,t),output=listprocedure);
for tt from 0 to 1 by 0.2 do
   for xx from -5 to 5 by 2 do
      print(tt,xx,rhs(ut[3])(xx,tt));
   end do;
end do;

gives values of t,x and u, e.g., 

                 0, -5, -1.00011793431098361

                  0, -3, -0.995054753686730464

                  0, -1, -0.653755734133799948

                   0, 1, 0.653755734133799948

                   0, 3, 0.995054753686730464

                   0, 5, 1.00011793431098361

etc.

(You can also do a 3D plot to see the data:

sol:-plot3d(t=0..1,x=-15..15,axes=boxed);
)

 

 

To get time, x, u values at a fixed time, e.g., t=1 use

u1:=sol:-value(u(x,t),t=1,output=listprocedure);

for x from -15 to 15 by 2 do rhs(u1[2]),x,rhs(u1[3])(x) end do;

gives:

                 1., -15, -0.99999999999995826

                 1., -13, -1.00000000159796176

                 1., -11, -1.00000001778633862

                  1., -9, -0.99999990540129812

                  1., -7, -1.00000347942147538

etc

 

First 72 73 74 75 76 77 78 Page 74 of 81