MaplePrimes Questions

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

Hello
Is it possible to reproduce this MathCad example in Maple?

The quantity diff(y)./diff(x) is an approximate derivative.

  • x = [1 2 3 4 5];
    y = diff(x)
    y =
         1     1     1     1
    
    z = diff(x,2)
    z =
         0     0     0
    

Given,

  • A = rand(1,3,2,4);
    

diff(A) is the first-order difference along dimension 2.

diff(A,3,4) is the third-order difference along dimension 4.


The function diff of Matlab calculates differences between adjacent elements of X along the first array dimension whose size does not equal 1

Is there a similar function in Mape?

 

Please, where are the statistical tolerance intervals in Maple, similar to those we have in MiniTab and in R ?  maybe in statistical quality control ?

Example 1 :  Package « tolerance » in R (https://cran.r-project.org/web/packages/tolerance/tolerance.pdf) : 

 

« Description :  Statistical tolerance limits provide the limits between which we can expect to find a specified proportion of a sampled population with a given level of confidence. This package provides functions for estimating tolerance limits (intervals) for various univariate distributions (binomial, Cauchy, discrete Pareto, exponential, two-parameter exponential, extreme value, hypergeometric, Laplace, logistic, negative binomial, negative hypergeometric, normal, Pareto, Poisson-Lindley, Poisson, uniform, and Zipf-Mandelbrot), Bayesian normal tolerance limits, multivariate normal tolerance regions, nonparametric tolerance intervals, tolerance bands for regression settings (linear regression, nonlinear regression, nonparametric regression, and multivariate regression), and analysis of variance tolerance intervals. Visualizations are also available for most of these settings. »

 

Example 2 : 

https://support.minitab.com/en-us/minitab/18/help-and-how-to/quality-and-process-improvement/quality-tools/how-to/tolerance-intervals-normal-distribution/methods-and-formulas/methods-and-formulas/

https://support.minitab.com/fr-fr/minitab/18/help-and-how-to/quality-and-process-improvement/quality-tools/how-to/tolerance-intervals-nonnormal-distribution/methods-and-formulas/tolerance-intervals/   

The Maple Math button is not working for me in the MaplePrimes editor.  No matter what I enter as Maple Expression, I get You have entered an invalid Maple expression, no preview, and nothing is inserted.  The same goes for the Maple Plot button. 

I'm using Firefox 58.0.1 under Windows 10 (64 bit), but this also occurs with Internet Explorer.

   

Hi, i want to investigate  chaos for the problem , cantilever beam under random narro band excitation, but the code has errors .the code is this:

      restart:with(plots):      h:=1: Omega:=(0..376):alpha1:=617.2:alpha2:=1.02*10^(8): c:=.002:k:=18.4:  step:=0.1:imax:=376:  for i from 0 to imax do;  Omega[i]:=i*step:   f:=evalf(solve({((-a*Omega[i]^(2)+alpha1*a+3/(4)*alpha2*a^(3)+1/(4)*k*Omega[i]^(2)*a^(3)-(3)/(4)*k*Omega[i]^(2)*a^(3))^(2)+(c*Omega[i]*a^())^(2))=h^(2),a>0}));  ff[i]:=((rhs(f[1]))^(2))/(2):  end do:   l1:=[[Omega[n],ff[n]] $n=0..imax]:  p1:=plot(l1, x=0..3,y=0..1,  style=point,symbol=solidcircle,symbolsize=4,color=red):    jmax:=914: f1:=array(377..914):f2:=array(377..914):f3:=array(377..914):Omega1:=array(377..914):  for j from 377to jmax do;  Omega1[j]:=j*step:   fff:=evalf(solve({((-a*Omega1[j]^(2)+alpha1*a+3/(4)*alpha2*a^(3)+1/(4)*k*Omega1[j]^(2)*a^(3)-(3)/(4)*k*Omega1[j]^(2)*a^(3))^(2)+(c*Omega1[j]*a^())^(2))=h^(2),a>0}));  f1[j]:=((rhs(fff[1,1]))^(2))/(2):f2[j]:=((rhs(fff[2,1]))^(2))/(2):f3[j]:=((rhs(fff[3,1]))^(2))/(2):  end do:   ll1:=[[Omega1[n],f1[n]] $n=377..jmax]:  pp1:=plot(ll1, x=0..10,y=0..1,  style=point,symbol=solidcircle,symbolsize=4,color=red):    ll2:=[[Omega1[n],f2[n]] $n=377..jmax]:  pp2:=plot(ll2, x=0..10,y=0..1,  style=point,symbol=solidcircle,symbolsize=4,color=red):    ll3:=[[Omega1[n],f3[n]] $n=377..jmax]:  pp3:=plot(ll3, x=0..15,y=0..1,  style=point,symbol=solidcircle,symbolsize=4,color=red):       plot({  seq(seq(p1), seq(seq(pp1),seq(seq(pp2),seq(seq(pp3))  },style=point,title=`Pitchfork Diagram`);  Thanks for your help

I need to convert this Maple Table to a Matrix

table([(25, 1) = -39, (16, 151) = 32, (33, 1) = -54, (1, 1) = 29, (13, 1) = 32, (31, 101) = -7, (6, 51) = -10, (11, 101) = -1, (28, 151) = -39, (18, 51) = -65, (4, 151) = 29, (8, 151) = -10, (23, 101) = 23, (34, 51) = -54, (40, 151) = 87, (36, 151) = -54, (9, 1) = -1, (37, 1) = 87, (21, 1) = 23, (14, 51) = 32, (22, 51) = 23, (20, 151) = -65, (27, 101) = -39, (3, 101) = 29, (19, 101) = -65, (24, 151) = 23, (32, 151) = -7, (30, 51) = -7, (38, 51) = 87, (7, 101) = -10, (10, 51) = -1, (29, 1) = -7, (35, 101) = -54, (17, 1) = -65, (26, 51) = -39, (15, 101) = 32, (12, 151) = -1, (39, 101) = 87, (5, 1) = -10, (2, 51) = 29]) 

Hello,

I have difficulties to solve a small linear system.

I attach my code. It may be due to derivate variables but i'm not sure. I remember having solve before similar systems.

Analyse_cinematique_test2.mw

May you have a look at my code and tell me why the solve function doesn't return any results ?

Thank you for your help.

First 819 820 821 822 823 824 825 Last Page 821 of 2375