Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How do you can change value integrate 8+ln(3)-ln(7) into m+n*ln(3)+k*ln(7)

and ln(3), ln(7) can change into number other ...

help.mw

Its close to Valentine's Day on the 14th Feb.  I was hoping to combine the lemniscate and cardiod curves to make a decorative heart shaped "valentine".     Inn polar form the cardioid is r=2R(1 - cos theta)   and the lemniscate r=L*sqrt(cos(2*theta)

  However these are not with respect to the same origin:-(

Any suggestions please?

 

restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

#  Lemniscate - Cardioid - Valentine

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

#Lemniscate

pl1:=plot(sqrt(cos(2*x)),x=0..Pi/2, coords=polar, scaling=constrained):

#Cardioid

pl2:=plot(1-cos(x),x=0..3*Pi/4, coords=polar, scaling=constrained):

#pp1:=pointplot({seq([x/100,sqrt(cos(2*x/100))],x=0..150)});

##pp1:=seq(pointplot( {  [x/100,sqrt(cos(2*x/100)) ],x=0..150}) );

plots[display](pl1, pl2);

#l := {  seq(   point(  [x/100,sqrt(cos(2*x/100))]  ),x=0..150   )  }:

#l := {     point(  [0/100,sqrt(cos(2*0/100))]  ),point(  [2/100,sqrt(cos(2*2/100))]  ),point(  [4/100,sqrt(cos(2*4/100))]  )     }:

L:=11.30:R:=1.538:ext:=.2:

il:=floor(Pi*26-5);

#Lemniscate

#Equation of lemniscate in polar form is r=L*sqrt(cos(2*theta))

 

l:={seq(point([ext+cos(i/100),L*sqrt(cos(2*i/100))*sin(i/100)]),i=-78..il)}:

 

#Cardioid

#Equation of cardioid is r=2*R*(1-cos(theta))

#lc :={seq(  point(  [i/100,2*R*(1-cos(i/100))]  ), i=-ilast..ilast+30  )  }:

 

lc:={seq(point([cos(i/100),2*R*(1-cos(i/100))*sin(i/100)]),i=-4*il/3..il/4  )}:

 

 

plots[display](l,lc, axes=normal, scaling =constrained);

#l := point([0,0], color=green):

#plots[display](l, axes=boxed);

 

 

##pointplot({seq([n,sin(n/10)],n=0..30)});

 

 

printf("             Lemniscate                    Cardioid\n");

 

#ibeg:=convert(-4*il/3, float): iend:=il/4:

ibeg:=  -78:  #floor(-4*il/3):

iend:=floor(il/4):

 

for i from ibeg to iend do

#whattype(i);

xl:=evalf(ext+cos(i/100)): yl:=evalf(L*sqrt(cos(2*i/100))*sin(i/100)):

rr:=evalf(  L*sqrt(  cos(2*i/100)  )):

 

yc:=2*R*(1-cos(i/100))*sin(i/100):

rrc:=2*R*(1-cos(i/100)):

#  printf(" i = %d \n",i);

if type(xl, nonreal) or type(yl, nonreal) then

   printf("i=%d   xl or yl are not real\n", i);

                                          else  

 printf("i=%d   x=%4.3f   y=%4.3f r=%4.3f      yc=%4.3f  r_card=%4.3f\n",i, xl,yl,rr, yc, rrc);

end if;

end do:

Padovan is a British architect, more of whom van be found by googling 'Padovan series'.

  The program below draws the first few equilateral triangles of sides of which are in a series something akin to the Fibonacci sequence.  P(n)=P(n-2)+P(n-3).  It starts 1, 1, 1, 2,...The program below outputs a display of the first few such triangles, but is very klutsy.  It has a "manual input" for the various triangles.  I wondered if there was a quick way of doing this perhaps using theseq command?

  Thanks in advance.  David

 

 

 

 restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

#

#  Padovan

#

#  Series of equilaterla triangles of sides of length:

#  P(n)=P(n-2) + P(n-3)

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

# etring_up draws an equilateral triangle of side s, pointing up with # [x0,y0] being the coords of the "western most" vertex.

etring_up:=proc(x0,y0,s)

local tt, h:

h:=s*sqrt(3)/2:

tt:=polygon([[x0,y0],[x0+s/2,y0+h],[x0+s,y0]], color=brown, linestyle=1, thickness=1);

plots[display]([tt], scaling=constrained);

end proc:

 

# etring_down draws an equilateral triangle of side s, pointing down

# with [x0,y0] being the coords of the "western most" vertex.

etring_down:=proc(x0,y0,s)

local tt, h:

h:=s*sqrt(3)/2:  #2*s/sqrt(3):

#Only difference between two procs is the minus sign in [x0+s/2,y0-h]

tt:=polygon([[x0,y0],[x0+s/2,y0-h],[x0+s,y0]], color=red, linestyle=1, thickness=1);

plots[display]([tt], scaling=constrained);

end proc:

#etring_down(0,0,2);

#etring_up(0,0,2):

plots[display]([etring_down(0,0,1),etring_up(0,0,1),etring_down(1/2,sqrt(3)/2,1),etring_up(1/2,-sqrt(3)/2,2), etring_down(3/2, sqrt(3)/2,2),etring_up(1/2,sqrt(3)/2,3), etring_down(-2, 2*sqrt(3),4),etring_up(-9/2,-sqrt(3)/2,5),etring_down(-9/2,-sqrt(3)/2,7),etring_up(-1,-4*sqrt(3),9),etring_down(2,2*sqrt(3),12),etring_up(-2, 2*sqrt(3),16),etring_down(-15,10*sqrt(3),21)], scaling=constrained);

Hi all.

Hope the best for all

In the following program(written code), why i can't achieve the proper combined function in HybrFunc(2, 3, 1)?
Code1.mws

thanks for any help

Hi everybody,

I am trying to solve a partial differential equation for wich the boundary condition is evaluated at a point which depends on the other variables. When I try the command

pdsolve({diff(u(x, z, t), z)+C = 0, u(x, h(x, t), t) = 0}, u(x, z, t))

I get Error, (in PDEtools:-Library:-NormalizeBoundaryConditions) unexpected occurrence of the variables {t, x} in the 2nd operand of u(x, h(x, t), t) in the given initial conditions.

In my code I can not rename my variables and I need to evaluate z at h(x, t) and obtain a solution as a function of h(x,t). Is the any way to do it? Any solutions?

Thanks a lot for your help,

Javier

I was asked to write a procedure according to the description as follow:

where https://en.wikipedia.org/wiki/Euler%27s_totient_function means the Euler's function.

Could someone help me? I struggle from the very beginning since

1.I don't know what code is responsible for "counting" element in maple

2.I don't know how to restrict my domain to Z

Thanks.  

Hi.

From what I can tell this is a common problem that comes up on the forums once and a while where most response provide answers that don't hit the core of the problem.  That being, when using the plot function in maple how do we properly have it plot a function that contains units within it.  This is an important feature for anyone who works with problems where unit tracking and conversion must be checked, yet the problem complexity becomes large enough such that this isn't feasible to do by hand.

To give a brief example:

T := (.2*11600)*Unit('K');
n__0 := 10^12*Unit(1/'m'^3);
Q := 0.865e-11*Unit('C');

lambda__D := sqrt(epsilon__0*k__B*T/(n__0*q__e^2));
 = 
              lambda__D := 0.003326865078 Unit(m)

Phi__F := proc (r) options operator, arrow; (1/4)*Q/(Pi*epsilon__0*r) end proc;
Phi__P := proc (r) options operator, arrow; Phi__F(r)*exp(-r/lambda__D) end proc;

 

Now lets say I want to plot the Phi functions this would require a plot function with a range that is in the units of meters.  But if I enter the statement:

plot(Phi__F(r), r = 0.1e-1*lambda__D .. 4*lambda__D)

I will produce a plot with the incorrect units on the y-axis, even though lambda__D is in units of meter, likewise the same thing will occur if I try to append the meter unit to the range manually.

plot(Phi__F(r), r = 0.1e-1*lambda__D*Unit('m') .. 4*lambda__D*Unit('m'))

Now, we can make progress if we define the unit of r within the function definition itself.

plot(Phi__F(r*Unit('m')), r = 0.1e-1*lambda__D .. 4*lambda__D)

So "Yay!", right?  Where as I have mixed feelings on that since a range shouldn't require unit additions in the function itself this is at least functional.  The second part of this problem occurs when you try to plot two functions at once, say both Phi__F and Phi__P as follows

plot({Phi__F(r*Unit('m')), Phi__P(r*Unit('m'))}, r = 0.1e-1*lambda__D .. 4*lambda__D);
Warning, expecting only range variable r in expression .7777911056e-1/r*Units:-Unit(V) to be plotted but found name V

Now we recieve a warning message and an empty plot.  For some reason maple things that V is a variable, not a unit.  What the hell?  I would like a little help here as the online docs are useless.

 

-- Matt

P.S.  If you'd like to know more about the example problem it happens to deal with the debye length of a plasma.

Is there any way to convert a complex number in to a phasor angle (radians or degrees) like the one marked below?

I don't understand why evalb(2^(n+10)-1024*2^n = 0) returns false. The expression can be simplified to 0.

Am I misusing evalb?
 

assume(n, integer, n > 0)

NULL

f := proc (n) options operator, arrow; 2^(n+10) end proc

proc (n) options operator, arrow; 2^(n+10) end proc

(1)

g := proc (n) options operator, arrow; 1024*2^n end proc

proc (n) options operator, arrow; 1024*2^n end proc

(2)

g(n)-f(n)

1024*2^n-2^(n+10)

(3)

"(=)"

0

(4)

evalb(1024*2^n-2^(n+10) = 0)

false````

(5)

``


 

Download temp.mw


In the following workbook, I defined two equivalent one variable functions and plot their difference.

I'm surprised to see that the difference is not 0 between 55 and 60. But when I computed the respective function's values at these points, the difference is 0.

assume(n, integer, n > 0)

``

f := proc (n) options operator, arrow; 2^(n+10) end proc

proc (n) options operator, arrow; 2^(n+10) end proc

(1)

g := proc (n) options operator, arrow; 1024*2^n end proc

proc (n) options operator, arrow; 1024*2^n end proc

(2)

g(n)-f(n)

1024*2^n-2^(n+10)

(3)

"->"

 

``

map(f, [seq(i, i = 55 .. 60)])

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]

(4)

map(g, [seq(i, i = 55 .. 60)])

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]

(5)

[36893488147419103232, 73786976294838206464, 147573952589676412928, 295147905179352825856, 590295810358705651712, 1180591620717411303424]+[-36893488147419103232, -73786976294838206464, -147573952589676412928, -295147905179352825856, -590295810358705651712, -1180591620717411303424]

[0, 0, 0, 0, 0, 0]

(6)

``


 

Download temp.mw

HI Guys,

 

i have a problem with evaluating a tensorial term,

 

Thanks

 

JJ.mw

 

Hello, i'm writing a code but when i run it, the maple shows this msg, can someone say what is wrong?

regards,

 

restart;
nn := 13;
                               13
oe := 4;
num := 12;
                               12
n1 := 1;
fac := 1;
                               1
delta := 0;
                               0
X := alf;
alf0 := 1/(sum(fac^j, j = 0 .. num-1));
                               1
                               --
                               12
Y := alf;
xnH := vector(nn);
ynH := vector(nn);
for j to num+1 do;
 if j+n1-1 <= nn then                
       alf := alf0 * delta:
        if oe = 2 then
           if irem(j,2)=1 then
              xnH[j+n1-1] := eval(X);    
              ynH[j+n1-1] := eval(Y);
           else
              deltaI:=((delta-1)/fac-1)/fac;
              deltaF:=delta;
              delta:=(deltaF-deltaI)/2+deltaI;
              alf := alf0 * delta;
              xnH[j+n1-1] := eval(X);    
              ynH[j+n1-1] := eval(Y);
              delta := deltaF;
            end if;
        end if;
if oe = 3 then
              if irem(j,3)=1 then
              xnH[j+n1-1] := eval(X);    
              ynH[j+n1-1] := eval(Y);
              elif irem(j,3)=2 then
              deltaI:=((delta-1)/fac-1)/fac;
              deltaF:=delta*fac+1;
              delta:=(deltaF-deltaI)*(0.5-1/(2*sqrt(5)))+deltaI;
              alf := alf0 * delta;
              xnH[j+n1-1] := eval(X);    
              ynH[j+n1-1] := eval(Y);
              delta := (deltaF-1)/fac;
              elif irem(j,3)=0 then
              deltaI:=(((delta-1)/fac-1)/fac-1)/fac;
              deltaF:=delta;
              delta:=(deltaF-deltaI)*(0.5+1/(2*sqrt(5)))+deltaI;
              alf := alf0 * delta;
              xnH[j+n1-1] := eval(X);    
              ynH[j+n1-1] := eval(Y);
              delta := deltaF;
              end if;
end if;
        if oe = 4 then
                if irem(j,4)=1 then
                xnH[j+n1-1] := eval(X);    
                ynH[j+n1-1] := eval(Y);
                delta := delta * fac + 1;
                elif irem(j,4)=2 then
                deltaI:=((delta-1)/fac-1)/fac;
                deltaF:=(delta*fac+1)*fac+1;
                delta:=(deltaF-deltaI)*(0.5-sqrt(21)/14)+deltaI;
                alf := alf0 * delta;
                xnH[j+n1-1] := eval(X);    
                ynH[j+n1-1] := eval(Y);
                delta := (((deltaF-1)/fac)-1)/fac;
                elif irem(j,4)=3 then
                deltaI:=(((delta-1)/fac-1)/fac-1)/fac;
                deltaF:=delta*fac+1;
                delta:=(deltaF-deltaI)*(0.5)+deltaI;
                alf := alf0 * delta;
                xnH[j+n1-1] := eval(X);    
                ynH[j+n1-1] := eval(Y);
                delta := (deltaF-1)/fac;end if:
                elif irem(j,4)=0 then
                deltaI:=((((delta-1)/fac-1)/fac-1)/fac-1)/fac;
                deltaF:=delta;
                delta:=(deltaF-deltaI)*(0.5+sqrt(21)/14)+deltaI;
                alf := alf0 * delta;
                xnH[j+n1-1] := eval(X);    
                ynH[j+n1-1] := eval(Y);
                delta := deltaF;
                end if;
       end if;
end if;
od;

 

Hi everybody!

I am generating MATLAB code for a matrix created in Maple 2017 using the following code:

CodeGeneration[Matlab]([codegen[optimize](matrix)]);

My question now: How can I specify that the generated code should not include zero elements of the matrix.

Since the matrices are sparse, there are hundrets of lines indicating zeros elements.

This is not necessary since I initialise the matrix with zeros in MATLAB anyway.

Many thanks for your help!

 

I am trying to estimate psi and gamma from the following root finding Eqs. How can I do this?

It should be noted that paramaters other than psi and gamma are assumed to be specified.

Hello,

I have some problems with small perturbations around background solutions and obtaining linearized equations.

I know how to perturb a metric (tensor) with maple but i dont know how to use it for obtaining other perturbed equations.

ss.mw

Best

First 854 855 856 857 858 859 860 Last Page 856 of 2216