Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Why does the following code 

evalb(a * conjugate(a) = abs(a) ^ 2);

not produce true?

In ScientificConstants, the density of carbon is given as 2.2 g/cm^3. That happens to be the value for graphite. Carbon comes in different states with different density, diamond being one of them, amorphous being another. Is this somewhere in ScientificConstants where just I cannot find it, or is it not there?

TIA,

M.D.

PS: I do know the values and where to find them (Particle Data Group). I'd like to use ScientificConstants so I can write a more general piece of code.

My worksheet is shown below. I am copying an example from a textbook and know that h = 26.4 is correct.

However, if I use !!! (execute entire worksheet) then I get h = -13

What an i doing wrong

Thanks

The Maple help contains a nice example of a puzzle solver named alphametic,  see  ?Iterator,Permute.
The goal is to determine the distinct digits represented by letters which satisfy a given  equation. The provided solved example is:

        "16540*781 = 12904836 + 12904"
i.e.  m=1, a=6, p=5 etc.

It's worth studying the program (written as a module) because it includes a few useful techniques.
I would suggest the following exercise for a Maple (young) programmer.

1.  When solving the "classical" puzzle  "FORTY+TEN+TEN=SIXTY", instead of the correct answer "29786+850+850=31486",   you will see
"2978Y+850+850=3148Y".
Try to find what's going on and correct the code.

2. The solutions given by alphametic include numbers beginning with a zero.
Execute e.g. .
Modify the code to produce only standard numbers.

 

Hi 

I am having problems with the syntax/symbols i maple. I down know what "setting" has changed but + and - and so on, has change to K and C. anyone know how to fix this?

Regards

Morten

 

I have just found that the standard routine of Maple for performing mod 2 multivariate factorization, that is
Factor(p) mod 2
takes a very long computing time (I stopped after a long while) for the polynomial

p := K[4]*(K[4]^2*K[5]*K[6]^3*K[7]^2+K[4]*K[5]^2*K[6]^4*K[7]+K[4]^3*K[6]^2*K[7]^2+K[4]^2*K[5]*K[6]^3*K[7]+K[4]^2*K[5]*K[6]^2*K[7]^2+K[4]*K[5]^3*K[6]^3+K[5]^3*K[6]^4+K[4]^2*K[5]^3*K[6]+K[4]^2*K[5]^2*K[6]^2+K[4]^3*K[5]^2+K[4]^2*K[5]^3);

Note that the factorization of this polynomial is very fast on other computer algebra systems. Since mod 2 multivariate factorization (in fact, normalization of mod 2 multivariate rational functions) is essential for some algorithms that I'm currently implementing in Maple, I would ask if you know how to improve (bug, additional parameters?) the function Factor or if there are other functions, packages in Maple which implement a more feasible mod 2 multivariate factorization.

Many thanks in advance.

Define a piecewise function of  so that the the value of the function is  if  or if , it is equal to the vertical distance between the curves if . Numerically integrate the area under this curve on the non-zero interval and explain how the numerical answer is what you would anticipate the answer to be given that this curve is related to semi-circles.

The curve is defined by

Hi everyone,

Was hoping someone could point me in the right direction. A homework question asks us to create a function using arrow (->) notation which take a Maple list of complex numbers as its input and returns the largest modulus from that list.

I've tried writing this without arrow notation --

Say L1 is a list of complex numbers:

max(abs~(L1))

and this seems to work fine. But I'm particularly struggling with how to introduce the arrow notation into this.

Any help would be much appreciated!

Hi. Can anyone help me with this error, it says 

Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

 

restart

Shootlib := "F:\MAPLE\3";

"F:MAPLE3"

(1)

libname := Shootlib, libname;

"F:MAPLE3", "C:\Program Files\Maple 2015\lib", "."

(2)

with(Shoot);

[shoot]

(3)

with(plots):

``

FNS := {`φp`(eta), f(eta), fp(eta), fpp(eta), fppp(eta), phi(eta), theta(eta), `θp`(eta)}

{`φp`(eta), f(eta), fp(eta), fpp(eta), fppp(eta), phi(eta), theta(eta), `θp`(eta)}

(4)

ODE := {diff(`φp`(eta), eta) = (-f(eta)*`φp`(eta)+K*phi(eta)*(1-phi(eta))^2)*Sc, diff(f(eta), eta) = fp(eta), diff(fp(eta), eta) = fpp(eta), diff(fpp(eta), eta) = fppp(eta), diff(fppp(eta), eta) = (-fppp(eta)-f(eta)*fpp(eta)+k1*(2*fp(eta)*fppp(eta)-fpp(eta)^2)+lambda*fp(eta)+(1+Fr)*fp(eta)^2)/(k1*f(eta)), diff(phi(eta), eta) = `φp`(eta), diff(theta(eta), eta) = `θp`(eta), diff(`θp`(eta), eta) = (-f(eta)*`θp`(eta)+y*f(eta)*fp(eta)*`θp`(eta))/(1/Pr-y*f(eta)^2)}

{diff(`φp`(eta), eta) = (-f(eta)*`φp`(eta)+K*phi(eta)*(1-phi(eta))^2)*Sc, diff(f(eta), eta) = fp(eta), diff(fp(eta), eta) = fpp(eta), diff(fpp(eta), eta) = fppp(eta), diff(fppp(eta), eta) = (-fppp(eta)-f(eta)*fpp(eta)+k1*(2*fp(eta)*fppp(eta)-fpp(eta)^2)+lambda*fp(eta)+(1+Fr)*fp(eta)^2)/(k1*f(eta)), diff(phi(eta), eta) = `φp`(eta), diff(theta(eta), eta) = `θp`(eta), diff(`θp`(eta), eta) = (-f(eta)*`θp`(eta)+y*f(eta)*fp(eta)*`θp`(eta))/(1/Pr-y*f(eta)^2)}

(5)

blt := 4.; 1; IC := {`φp`(0) = Psi, f(0) = 0, fp(0) = 1, fpp(0) = 0, fppp(0) = alpha, phi(0) = 0, theta(0) = 1, `θp`(0) = beta}

4.

 

{`φp`(0) = Psi, f(0) = 0, fp(0) = 1, fpp(0) = 0, fppp(0) = alpha, phi(0) = 0, theta(0) = 1, `θp`(0) = beta}

(6)

BC := {fp(blt) = 0, fpp(blt) = 0, phi(blt) = 1, theta(blt) = 0};

{fp(4.) = 0, fpp(4.) = 0, phi(4.) = 1, theta(4.) = 0}

(7)

``

infolevel[Shoot:-shoot] := 1:

.7

 

1.0

 

.2

 

.2

 

1.0

 

.3

 

.5

 

.3

(8)

S := shoot(ODE, IC, BC, FNS, [alpha = 3.0125, beta = -2.31, Psi = -0.])

shoot: Step #  1

shoot: Parameter values :  alpha = 3.0125 beta = -2.31 Psi = -0.

Error, (in unknown) cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

 

p := odeplot(S, [eta, fp(eta)], 0 .. 15)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p)

Error, (in plots:-display) expecting plot structure but received: p

 

p2 := odeplot(S, [eta, theta(eta)], 0 .. 10)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p2)

Error, (in plots:-display) expecting plot structure but received: p2

 

p3 := odeplot(S, [eta, phi(eta)], 0 .. 10)

Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

 

display(p3)

Error, (in plots:-display) expecting plot structure but received: p3

 


 

Download Darcy.mw

Below are five subsindets commands.

I believe I understand the actions of B and C, but I fail to understand the actions, individually and taken together, of  E, F and G.

 

B := subsindets(u(i, j)^2*v(i, j)+u(i-1, j), 'specfunc(u)', proc (f) options operator, arrow; subsop(1 = op(1, f)+1, f) end proc);

C := subsindets(u(i, j)^2*v(i, j)+u(i-1, j), 'specfunc(anything, u)', proc (f) options operator, arrow; subsop(1 = op(1, f)+1, f) end proc);

E := subsindets(u(i, j)^2*v(i, j)+u(i-1, j), 'specfunc(symbol, u)', proc (f) options operator, arrow; subsop(1 = op(1, f)+1, f) end proc);

F := subsindets(u(i, j)^2*v(i, j)+u(i-1, j), 'specfunc(`+`, u)', proc (f) options operator, arrow; subsop(1 = op(1, f)+1, f) end proc);

G := subsindets(u(i, j)^2*v(i, j)+u(i-1, j), 'specfunc({`+`, symbol}, u)', proc (f) options operator, arrow; subsop(1 = op(1, f)+1, f) end proc);

Where can I find a thorough explanation of specfunc with examples?

Hi,

I am looking for a function which gives me the name of a variable. Something like NameOf :

-------------------

x:=1;

y:=Array(1..2);

NameOf(x);

"x"

Nameof(y);

"y"

-----------------------------------

It must be standard but I am very new to Maple...

Thanks,

 

 

{R = 7.339698158, S = 2.378491488, W = 2.512047349}

if i have thes set as aresult of multibull equations by using fsolve how to say to maple assign the value of R to another parameter say X and the value of S to Y and so on ???

please help

Any one can help me to convert matlab codes to maple.Matlab_code.mw
 

%Finite element method code for solving bvp nonlinear ODEs%

% u''+uu'-u=exp(2x), u(0)= 1, u(1)=e     %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function FEM_Code()

clear all; close all; clc

n=5;                     % NO of element

nn=n+1;                  % No of nodes

lgth=1;                  % Domain length

he=lgth/n;               % lenth of each elemnet

x=[0:he:lgth];           % Data point for independant variable

AC=0.00005;              % Accuracy

F=zeros(nn,1);           % Initialization

F(1)=exp(0); F(nn)=exp(1);  % Boundary conditions

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Direct Iterative process to handle nonlinear problem

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

c=1.0;

count=0;                   % Initializations for count for iterations

tic                        % Time start

while (c>0)

        [F1]=assembly(F,n,he);

          c=0.0;

          for i=1:nn

            if (abs(F(i)-F1(i))>AC)

                 c=c+1;

                 break;

            end

          end

         F=F1;

         count=count+1;

end

  disp('Hence solution=:');

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  % Output for prinmary and secondary variables %%%

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  diff=abs(F-exp(x)');

  fprintf('No of element=%d\n',n)

  disp('      x       FEM          Exact       Error')

  disp([x',F,exp(x)',diff])

  fprintf('No of iterations=%d\n',count)

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  %%% Ploting of primary variable %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  

  plot(x,F,'--rs','Linewidth',2)

  xlabel('x')

  ylabel('u(x)')

  title('solution plot to given BVP')

  toc                                % given totlal time

  

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Derivative of element matrix and Assembly%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

function [F1]=assembly(F,n,he)

nn=n+1;

k = zeros(nn,nn);               % Initialization of main Matrix

R = zeros(nn,1);                % Initialization of RHS Matrix

syms x                          % x as symbolic variable

s=[1-x/he,x/he];                % linear shape function

ds=diff(s,x);                   % Differentiations of shape function

lmm =[];

for i=1:n

    lmm=[lmm;[i,i+1]];          % connectvity Matrix

end

for i=1:n

    lm=lmm(i,:);

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%% Generation of Element Matrix k11 and RHS Matrix f1%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    k11=-int(ds'*ds,x,0,he)+(int(s'*ds*s(1),x,0,he)*F(lm(1))...

        +int(s'*ds*s(2),x,0,he)*F(lm(2)))-int(s'*s,x,0,he);

    f1 = int(exp(2*(x+(i-1)*he))*s',x,0,he);

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%% Assembly accroding to connectivity Matrix%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    

    k(lm,lm) = k(lm,lm) + k11;

    R(lm) = R(lm) + f1;

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Imposing Boundary Conditions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

k(1,:) = 0.0; k(nn,:) = 0.0;

k(1,1) = 1.0; k(nn,nn) = 1.0;

R(1,1) = F(1); R(nn,1) = F(nn);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Solution of equations (F1) %%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

d = k\R;           % better than using inverse k*R

F1 = d;

end

 

    

 

                                

 

 

 

  

        

      

 

 

 

 

 

 


 

Download Matlab_code.mw

i am attaching the codes and file. i will be thankful to you .

When I solve in worksheet mode the limit of (2*abs(x-2)+abs(x+1)-3)/(abs(x^2-4)+x-2) evaluating the limit in x=2- the result is 1/3 and in x=2+ the result is 3/5, but if I try to use the Tutorial/Single Variable/Limits, an error occurs.

Any Suggestion?

 

First 636 637 638 639 640 641 642 Last Page 638 of 2097