Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

From help it says

"For any variable used within a procedure without being explicitly
mentioned in a local localSequence; or global globalSequence; the
following rules are used to determine whether it is local or global:

The variable is searched for amongst the locals and globals (explicit or implicit)
in surrounding procedures
, starting with the innermost.  If the name is
encountered as a parameter, local variable, or global variable of such
a surrounding procedure, that is what it refers to."

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

So it seems if I do not use explicit "global" on a variable, Maple can figure
if it is global or not using the above rules. But when I use explicit "global"
on a variable, Maple did not seem to do the same thing. Here is an example
 

restart;
foo:=proc()
  local a, inner_proc;

  inner_proc := proc()
     local b;
     b   := ithprime(10);
     a   := b; #this assiged the global (to this proc)
               #variable, which is "a" correctly
  end proc;

  inner_proc();

  return(a);
end proc;

calling foo() gives 29.

But since the variable "a" in foo() is a global with respect to the inner_proc() (based on what the above help page seems to say), then why this does not work

restart;
foo:=proc()
  local a, inner_proc;

  inner_proc := proc()
     local b;
     global a;
     b   := ithprime(10);
     a   := b;                
  end proc;

  inner_proc();

  return(a);
end proc;

Now foo() returns "a". So Maple did not assign 29 to the global "a", (global to the inner_proc).

This for me makes little sense. Is global in Maple means the outermost scope only, skipping everything in between?

I thought global means any variable outside the proc itself. So if the proc() was inside another proc(), then the variables in the outer proc are global to the inner proc, even if they are declared local to the outer proc.

Why did Maple not do the assignment when I explicitly declare "a" to be global in the inner proc?

 

If you type ithprime (10^7) and hit return, the answer 179424673 is returned instantaneously, but if you do ithprime(10^8) there is no answer in ~ one hour plus (and maybe never), it just says “evaluating” and no answer comes. I have done calculations in Maple where the answer was a prime with ~18,000 digits yet cannot get beyond ithprime(10^7) when writing a code that needs to work up the prime list, looking for a particular one. Has anyone else encountered this apparent limitation in Maple?

Is there a way around it? 

I'm having a hard time trying to understand and use the various fitting functions.

For starters, if I copy and paste the code from the example on the Maple support Help page for NonlinearFit(), I'm not able to successfully execute the code. It gives the error:

Error, (in Statistics:-NonlinearFit) complex value encountered

I've attached my Maple file: testing_nonlinearfit.mw

Hello,

     I'm having trouble simplifying this square root:

assume(p::positive):
sqrt(sqrt(p^2+1)-1)*sqrt(sqrt(p^2+1)+1):
expand(%);

I expect it to give just p but instead it returns the full, unsimplifed expression.

This appears as part of a larger expression, and if it fails to simplify, terms won't cancel and the expression is much longer than it needs to be.

Thanks!

Mukhametshina Liya

Games with pseudo-fractals
 

Homothety_Fractals.mw

 

  

  

I would like to define a fourth-order tensor (3x3x3x3) with zeros, for then defining some non-null terms individually. For that, I'm currently doing:

for it1 from 1 to 3 do
    for it2 from 1 to 3 do
        for it3 from 1 to 3 do
            for it4 from 1 to 3 do
                H[it1,it2,it3,it4]:= 0;
            end do:
        end do:
    end do:
end do:

H[1,1,1,1]:= value1:
H[1,2,2,1]:= value2:
# etc.

 

However, I suppose there is probably a more efficient manner to do do, maybe using Physics package. Does anyone know to do that?

Hello,

I have a very simple problem. When Maple displays long outputs I can only see a part of them. Here there is an example

https://www.dropbox.com/s/ymp1vdsg80ewu1s/Untitled.jpeg?dl=0

On my previous versions of Maple I had a slider on the bottom of the page. How can I activate it in Maple 2016?

Thanks, Nicola

Aleksandrov Denis,
7th grade
secondary school #57 of Kazan

_ANIMATED_PICTURE_ON_THE_COORDINATE_PLANE_Aleksandrov_D..mw

 

Why does Maple dsolve give this strange error from dsolve? I do not see that the input is wrong

restart;
F := x * ( y(x) + x*sqrt(x*y(x)) + sqrt(x^3*y(x)) );
ode:= diff(y(x),x) = F;
dsolve(ode,y(x));

I do not see where the input is invalid. I stared at it for 5 minutes.

Mathematica can solve this as follows

ode = y'[x] == x ( y[x] + x Sqrt[x y[x]] + Sqrt[x^3 y[x]]  )
DSolve[ode, y[x], x]

Did I type something wrong in Maple?

Physics:-Version();
    2018, June 12, 1:40 hours, MapleCloud version: 60

 

 

I want z  to becomes abs(z) then later on, remove abs() and obtain z back in the same form it was.

I found that Maple changes z when I put it inside abs. Like this

expr:=(-y^2+1);
abs(expr);
op(1,%);

So instead of 1-y^2, I end up now with  y^2-1. I want to keep the same expression I started with.

Mathematica does not do this:

expr = 1 - y^2
Abs[expr]
%[[1]]

Is there a way or option to tell Maple not change the expression when I put it inside abs()?

This complicates what I am trying to do in Maple.

thank you

Hello,

I've tried many combinations of assume(), simplify(), expand(), and evalc(), and I simply can't figure out how to make Maple evaluate my symbolic expression as a purely real valued expression. I know that my expression must be able to be expressed solely in real-valued terms since any number times its complex conjugate is real-valued. What function do I use to accomplish this? Thanks for your consideration. I've attached the code in question below.

Ian

testing_real_simplification.mw

restart;
v := 6000;

# Define the Fresnel reflection coefficient, rp
eta0 := 4; eta1 := n1+I*kappa1;
theta0 := (1/180)*ang*Pi; theta1 := arcsin(eta0*sin(theta0)/eta1);
xi0 := eta0*cos(theta0); xi1 := eta1*cos(theta1);
rp := (-eta0^2*xi1+eta1^2*xi0)/(eta0^2*xi1+eta1^2*xi0);

# Define the complex conjugate of the Fresnel reflection coefficient, rpCon
eta1Con := evalc(conjugate(eta1));
theta1Con := arcsin(eta0*sin(theta0)/eta1Con);
xi1Con := eta1Con*cos(theta1Con);
rpCon := (-eta0^2*xi1Con+eta1Con^2*xi0)/(eta0^2*xi1Con+eta1Con^2*xi0);

# Take the product of rp and its complex conjugate, rpCon. This should necessarily evaluate to a real-valued quantity.
prod := evalc(rp*rpCon);

Hello, i am a student from Germany and have a question:

for a  written paper in microeconomics I have to draw an "Edgeworth Diagram" in Maple, so I have to display two functions ( indifference curves) in one box, which has two x axis and two y axis. All axis have to be positive and in one box. Maybe you can imagine one standard graph with x and y axis as a half of a cube, which gets completed by an other x and y axis with negative values (in our imagination, later the negative values should be transformed into positive values). All in all I have to build up a box with two complete coordinate systems. I mean that a need a plot with two different x axis and two different y axis. I read about but the possibility to define lines through the plottools package, but I really dont know.

Maybe one of you has an idea, which would be fantastic. If you cant follow my bad description, maybe its better to google "edgeworth diagram". 

Thank you all !

Hello.

I wrote a simple code for the plot of the function:

restart;
Omega := 2*Pi*N; R0 := a*tanh((a^2-mu)/(2*T_c))*ln((2*a^2+2*a*q+q^2-2*mu-I*Omega)/(2*a^2-2*a*q+q^2-2*mu-I*Omega))/q-2;                      
T_c := 0.169064e-1; mu := .869262; N := 10;
R1 := int(R0, a = 0.1e-3 .. 100);    
R2 := evalf(abs(R1));
plot(R2, q = 0.1e-2 .. 10);

If the parameter N is not equal to zero then after near one hour calculations I got the desired plot. But for N=0 I have an error

Error, (in signum) too many levels of recursion

I searched this error on this site but I can't find anything relevant for this problem.

Thank you in advance for the help.

 

What is the correct idiom in Maple to do subexpression replacement?

Suppose I want to replace each occurance of ln(anything) by ln(abs(anything)) in an expression.

Currently I call indets and then loop over each entry and use patmatch to do the replacement.

Is there a better method than what I doing now? Here is an example

restart;
expr := 7*ln(arcsin(x))-(1/2)*ln(x-1)*sin(x)-(1/2)*ln(x+1)+f;
lis:=indets(expr):
for z in lis do
    a:='a';b:='b';c:='c';
    if patmatch(z,a::anything*ln(b::anything)*c::anything,'la') then
       map(z0->assign(z0),la);
       expr:=subs(z = a*ln(abs(b))*c, expr);
    fi;
od:
expr;

I do not know if this will fails on some other cases yet.


 

restart

Digits := 4

"phi(x):=16*x^(2)*(1-x)^(2):"

``

a1 := int((diff(phi(x), x, x, x, x))*phi(x), x = 0 .. L)

(6144/5)*L^5-3072*L^4+2048*L^3

(1)

``

a3 := int(phi(x)*phi(x), x = 0 .. L)

(256/9)*L^9-128*L^8+(1536/7)*L^7-(512/3)*L^6+(256/5)*L^5

(2)

``

lambda := 0.170e-1

0.170e-1

(3)

B := 0.223e11

0.223e11

(4)

A := 0.346e11

0.346e11

(5)

k[n] := W*(4*R*G*L^2+pi^2*(2*n-1)^2)/(C*(pi^2*(2*n-1)^2+4*R*L^2*(G+W)))

W*(4*R*G*L^2+pi^2*(2*n-1)^2)/(C*(pi^2*(2*n-1)^2+4*R*L^2*(G+W)))

(6)

b[n] := 4*pi*(2*n-1)/(4*R*G*L^2+pi^2*(2*n-1)^2)

4*pi*(2*n-1)/(4*R*G*L^2+pi^2*(2*n-1)^2)

(7)

U := Heaviside(t)

Heaviside(t)

(8)

w := 1

1

(9)

L := 3.5

3.5

(10)

Ra := 9

9

(11)

Rb := 5

5

(12)

W := 1

1

(13)

G := 0.5e-3

0.5e-3

(14)

R := Ra+Rb

14

(15)

C := 0.2e-1

0.2e-1

(16)

h := 0.250e-1

0.250e-1

(17)

nu := .22

.22

(18)

I1 := (1/3)*w*h^3

0.5207e-5

(19)

E[0] := A+B

0.569e11

(20)

nu1 := (1-nu)/((1+nu)*(1-2*nu))

1.142

(21)

"beta(x,t):=1/(w*h)(W(∑)(-(Pi^(3)*b[n]*(2*n-1)^(3))/(k[n]*8*L^(3))*cos(((2*n-1)*Pi)/(2*L)*x)*(exp(-k[n]*t)))+(R*G*(R*G)^(0.5)*sinh((R*G)^(0.5)*(x-L)))/(cosh((R*G)^(0.5)*L))*t+C*U*(R*G*(R*G)^(0.5)*sinh((R*G)^(0.5)*(x-L)))/(cosh((R*G)^(0.5)*L)))*exp(-W/(C)*t)"

proc (x, t) options operator, arrow; (W*(sum(-(1/8)*Pi^3*b[n]*(2*n-1)^3*cos((1/2)*(2*n-1)*Pi*x/L)*exp(-k[n]*t)/(k[n]*L^3), n = 1 .. 8))+R*G*(R*G)^.5*sinh((R*G)^.5*(x-L))*t/cosh((R*G)^.5*L)+C*U*R*G*(R*G)^.5*sinh((R*G)^.5*(x-L))/cosh((R*G)^.5*L))*exp(-W*t/C)/(w*h) end proc

(22)

eq := -nu1*I1*a1*((1/2)*E[0]*q(t)+B*lambda*(int(exp(-lambda*(t-s))*q(s), s = 0 .. t)))+2*w*h^2*beta(x, t)

-0.4603e11*q(t)-0.6134e9*(int(exp(-0.170e-1*t+0.170e-1*s)*q(s), s = 0 .. t))+0.5000e-1*(-0.7235e-2*pi*(pi^2+686.)*cos(.4488*x)*exp(-50.*(.3430+pi^2)*t/(pi^2+686.))/(.3430+pi^2)^2-.5860*pi*(9.*pi^2+686.)*cos(1.346*x)*exp(-50.*(.3430+9.*pi^2)*t/(9.*pi^2+686.))/(.3430+9.*pi^2)^2-4.522*pi*(25.*pi^2+686.)*cos(2.244*x)*exp(-50.*(.3430+25.*pi^2)*t/(25.*pi^2+686.))/(.3430+25.*pi^2)^2-17.37*pi*(49.*pi^2+686.)*cos(3.142*x)*exp(-50.*(.3430+49.*pi^2)*t/(49.*pi^2+686.))/(.3430+49.*pi^2)^2-47.47*pi*(81.*pi^2+686.)*cos(4.039*x)*exp(-50.*(.3430+81.*pi^2)*t/(81.*pi^2+686.))/(.3430+81.*pi^2)^2-105.9*pi*(121.*pi^2+686.)*cos(4.937*x)*exp(-50.*(.3430+121.*pi^2)*t/(121.*pi^2+686.))/(.3430+121.*pi^2)^2-206.6*pi*(169.*pi^2+686.)*cos(5.834*x)*exp(-50.*(.3430+169.*pi^2)*t/(169.*pi^2+686.))/(.3430+169.*pi^2)^2-366.3*pi*(225.*pi^2+686.)*cos(6.732*x)*exp(-50.*(.3430+225.*pi^2)*t/(225.*pi^2+686.))/(.3430+225.*pi^2)^2+0.5616e-3*sinh(0.8367e-1*x-.2928)*t+0.1123e-4*Heaviside(t)*sinh(0.8367e-1*x-.2928))*exp(-50.00*t)

(23)

``


 

Download n-h-ie.mwn-h-ie.mw

First 797 798 799 800 801 802 803 Last Page 799 of 2219