nm

11558 Reputation

20 Badges

13 years, 135 days

MaplePrimes Activity


These are answers submitted by nm

I removed bc[4] but the code run withour any error but no solution displayed

It works for me on Maple 2019:


 

restart;

pde := diff(f(x, y), x $ 2) + diff(f(x, y), y $ 2) = 0;
bc[1] := f(x, 0) = exp(-x);
bc[2] := D[1](f)(0, y) = 0;
bc[3] := D[2](f)(x, 1) = 0;
sys := [pde, bc[1], bc[2], bc[3]];
sol := pdsolve(sys, f(x, y))

diff(diff(f(x, y), x), x)+diff(diff(f(x, y), y), y) = 0

f(x, 0) = exp(-x)

(D[1](f))(0, y) = 0

(D[2](f))(x, 1) = 0

[diff(diff(f(x, y), x), x)+diff(diff(f(x, y), y), y) = 0, f(x, 0) = exp(-x), (D[1](f))(0, y) = 0, (D[2](f))(x, 1) = 0]

f(x, y) = Sum(8*sin((1/2)*(1+2*n)*Pi*y)*((n+1/2)*Pi*(2+(1+(n+1/2)*Pi)^2*_C5(n))*exp((1/2)*(1+2*n)*Pi*x)+(n+1/2)*Pi*_C5(n)*(1+(n+1/2)*Pi)*(-1+(n+1/2)*Pi)*exp(-(1/2)*(1+2*n)*Pi*x)+2*exp(-x))/((1+2*n)^3*Pi^3+2*Pi^2*(1+2*n)^2), n = 0 .. infinity)+exp(-x)

 


 

Download foo.mw

One way could be

A:=Matrix([[0,1,0,1],[-1,3,0,0],[0,0,1,0]]);
ArrayNumElems(A,'NonZero')

5

in Maple index starts from 1 not zero. Try

 

f := proc (x, w)
     local k;   
     sum(w[k]*x^k, k = 1 .. nops(w))
end proc;

f(2, [a, b, c]);

No error now

But should not the call be f(x, [a, b, c]) ? I do not know what you are passing 2 there.

 

restart;

#note: no error checking is done. This assumes solution 
#exist and point are not colinear.

get_circle_equation:=proc(pt1,pt2,pt3,x,y)
 local q,p,r,res,eq,sol;
 res:=map(pt->(pt[1]-q)^2+(pt[2]-p)^2=r^2,[pt1,pt2,pt3]);
 sol:=solve(res,[q,p,r]);
 assign(sol);
 return (x-q)^2+(y-p)^2=r^2;
end proc:

pt1:=[1,2];pt2:=[-3,0];pt3:=[5,-4];
cir:=get_circle_equation(pt1,pt2,pt3,x,y);
plots:-implicitplot(cir,x=-10..19,y=-10..10)

 

I normally use unapply for these things as follows

aux := rsolve({y(0) = y0, y(n) = 4*y(n-1)*(1-y(n-1))}, y(n));
solucao := unapply(aux,n,y0);
solucao(3,1/2);

 

 

I can't reproduce this on 2018.2.1 on windows

restart;
with(LinearAlgebra):
switch:=proc(v::Vector)
 local w;
 w:=v;
 w:=[-1,-2,-3];
 w
end proc:
v1:=Vector([1,2,3]):
v2:=switch(v1);
v1;

 

v1 remain unchanged.

But it cause the problem if one changes one element at time, instead of complete assignment, as in:

restart;
with(LinearAlgebra):
switch:=proc(v::Vector)
 local w;
 w:=v;
 w[1]:=-1;
 w
end proc:
v1:=Vector([1,2,3]):
v2:=switch(v1);
v1;

 

Mathematica does not have this confusing behaviour. 

switch[v_] := Module[{w = v},
   w = {-1, -2, -3};
   w
   ];
v1 = {1, 2, 3};
v2 = switch[v1]

v1 remains the same here (like Maple). And

switch[v_] := Module[{w = v},
   w[[1]] = -1;
   w
   ];
v1 = {1, 2, 3};
v2 = switch[v1]

Here also v1 remains unchanged, as expected.  This is the behavior one would expect.  Notice that Mathematica does not have Vector or Matrix special structures, as every is list of lists. Maple behaves the same if ones uses list instead of Vector as well.

Maple seems to always convert sqrt(2)*exp(I*Pi/4)  to 1+I.

 

sqrt(2)*exp(I*Pi/4);

           sqrt(2)*((1/2)*sqrt(2)+I*sqrt(2)*(1/2))

simplify(%);

           1+I

If you want just to print it. you can do

p:=convert(z,polar);
sprintf("%s%a%s%a%s","the number is ", op(1,p), " exp(",(I*op(2,p)), ")");

                           the number is 2^(1/2) exp(1/4*I*Pi)

This is one of those things where CAS does automatic simplification.

Somethink like Matlab pause statment

 

try Threads:-Sleep(n); which maps to Matlab pause(n)

see https://www.maplesoft.com/support/help/maple/view.aspx?path=Threads%2fSleep

I am sure there is faster way, but this seems to give 5.

restart;
A := 11:
B := 21:
a := convert(A, base, 3);
a := ListTools:-Reverse(a);
b := convert(B, base, 3);
b := ListTools:-Reverse(b);
c := parse(cat(op(a)))+parse(cat(op(b)));
c := ListTools:-Reverse(convert(c, base, 10));
c := map(x->`mod`(x,3),c);
c := parse(cat(op(c)));
c := convert(c, base, 10);
c := convert(c,'base',3,10);
c := parse(cat(op(c)));

       5

it works for me on Maple 2018

PDE := diff(u(x, y), x, x)+diff(u(x, y), y, y)-6*x*y*(1-y)-2*x^3; 
BCs := u(0, y) = 0, u(1, y) = y*(1-y), u(x, 0) = 0, u(x, 1) = 0;
pdsolve({PDE,BCs},u(x,y));

 

    "but when will the newest version be released"

 

It is released today, March 21, 2018. I can see it in the online store of Maple.

restart;
ode := diff(1/r(phi), phi$2) + 1/r(phi)= GM/h^2;
ics := r(0)=2/3, D(r)(0)=0;
dsolve({ode,ics});

 

try escaping the \

    read "C:\\Users\\Ronan\\Documents\\MAPLE\\Rational Trinonometry\\Qdim.m";

It is also bad practice to use SPACES in file or folder names. Better to use _

so the above would be better as

    read "C:\\Users\\Ronan\\Documents\\MAPLE\\Rational_Trinonometry\\Qdim.m";

ps.   mpl as extension would be better than m

 

 

@Rouben Rostamian  

I've corrected my hand solution. I only checked before for one case test function and did not notice I am missing the odd part. 

Now the final solution I get is

 

Also animated the analytical solution for all three test functions below, and analytical solution now agrees with numerical.

I attach PDF with my solution. 

t.pdf

May be maping the interval first from -1..1 to 0..2 and then mapping again solution back to -1..1 at the end is a simpler method.

Animations

 

 

CAS systems are still relatively weak in analytical solutions of PDE's. Maple can solve this numerically though when given some specific f(x). Maple seems to only handle boundary conditions from zero to some positive length.

Mathematica can't solve this either analytically.

 

First 14 15 16 17 18 19 Page 16 of 19