Maple 2016 Questions and Posts

These are Posts and Questions associated with the product, Maple 2016

Hello,

i have a Problem with maple. I have written this simple procedure

myPi_1:=proc(r)
local i,l;
l:=0;
for i from 1 to floor(r) do
    if isprime(i) and (i mod 4 = 1) then
        l:=l+1;
    end if;
end do;
return l;
end proc:    

 

When i use it like this 

k := myPi_1(80);

it works

But when i triy to plot it

plot(myPi_1(t), t = 0 .. 500, numpoints = 500, thickness = 2, color = black);

i get this message
Warning, expecting only range variable t in expression myPi_1(t) to be plotted but found name myPi_1

And no plot

Thank you for any Help

 

 

 

 

I want to calculate the following integral numerically with required precision.

First, the functions are defined:

G1:=-0.9445379894;
f:= (x) -> 0.9/abs(x-0.4)^(1/3)+0.1/abs(x-0.6)^(1/2);
U1 := unapply(-exp(-x)*(evalf(Int(f(t)*exp(t), t = 0 .. x))+G1)/2-exp(x)*(evalf(Int(f(t)*exp(-t), t = 0 .. x))+G1)/2, x);
U:= unapply(-exp(x)/2*(evalf(Int(f(t)*exp(-t),t=0..x))+G1)+exp(-x)/2*(evalf(Int(f(t)*exp(t),t=0..x))+G1), x);

Next, I calculate the integral in numerical form:

evalf(Int(U1(x)^2+U(x)^2-2*f(x)*U(x), x=0..1, digits=4, method = _Gquad));

If I specify digits=4, Maple return the answer -0.4291

If I use digits=5 or larger, Maple return someting like this

Is it possible to increase precision of calculation?


 

 

Hey there!

 

this is the formula:

diff(ca(t), t) = -3.600000000*10^20*exp(-15098.13790/(340-20*ca(t)))*ca(t), ca(0) = 2

I can easily plot it by solving DE numerically, however I can't seem to find a way to determine what 't' is at ca(t)=0.2

 

thank you so much in advance!

Kind regards, 

Gerard 

Hello People in mapleprimes,

I have a question about collecting part of expression.
Please teach me an answer to this.

I want to modify a1 to b1.


e3.mw

Thanks in advance.

For a 2D parametric plot with only one parameter, in Maple we use plot([x,y,range]) but what about the case x and y are expressed by more than one parameter? How should I assign the range? For example I tried the following one

h := k[1]*k[3]+k[1]*k[4]+k[2]*k[4]:
x := k[2]/h:
y := (k[3]+k[4])/h:
A := seq(k[i] = 1 .. 2, i = 1 .. 4):
plot([x, y, A]);

But then I encountered the following error:
Error, (in plot) incorrect first argument [k[2]/(k[1]*k[3]+k[1]*k[4]+k[2]*k[4]), (k[3]+k[4])/(k[1]*k[3]+k[1]*k[4]+k[2]*k[4]), k[1] = 0.1e-2 .. 1000, k[2] = 0.1e-2 .. 1000, k[3] = 0.1e-2 .. 1000, k[4] = 0.1e-2 .. 1000]

For one parameter the above method doesn't make an error like the following:

x := t+1:
y := t^2:
A := t = 1 .. 2:
plot([x, y, A]);

So for more than one parameter, there should be another way to ask the plot. Does anyone know how to do that?

Try this command.

display(semitorus([0, 0, 0], 0 .. Pi, 1, 2), lightmodel = light4, orientation = [-140, 60], scaling = constrained, style = patchnogrid)

I get this mess. The picture on the help page doesn't look any better.Setting the range 0..2 Pi looks fine though. So I think it is a bug.

What I was trying to do is plot 3/4 of a torus i.e circle disk swept in 3/4 of a carcle with capped ends. What is a good way?

Hi all,

I am working on a Maple file to find the right force excerted in a specifik angle (theta). This is the script Maple than has to work out:

 

eq4 := Fh1 = (1/2)*(solFh2*sqrt(2)-40)/sin(theta);
eq5 := Fh1 = (1/2)*(solFh2*sqrt(2)-100)/cos(theta);
sol := solve({eq4, eq5}, {Fh1, theta});

Next it gives me the answers as following:

sol := {Fh1 = 121.6477702, theta = .9606764638}, {Fh1 = -121.6477702, theta = -2.180916190}

Which is correct: I get a force (Fh1 = ± 121.6477...) with 2 angles (theta = .9696... or theta=-2.1809...)

 

If i want to continue working with Fh1 it gives an error saying it has 2 values for it (obviously a positive and a negative value). Is there a way to continue working with the positive values of Fh1 and theta?

 

I was thinking of solving the intersect equation on the positive 'theta'-axis in a form like:

 

sol := solve({eq4, eq5}, {Fh1, theta>0}); as theta is my horizontal axis and a positve theta gives me a positive Fh1 but Maple doesn't work that straightforward. 

 

Thanks a lot!

Hi I was wondering if you can help me with some maple commands about using Euler's method. My professor created a tutorial on using some commands to calculate the value via Euler's method. 

Her commands in the tutorial for using Euler's method  for a differential equation- dy/dx= x+y   y(0)=1

x0:=0:y0:=1:xf:=1:n:=10:

h:=evalf((xf-x0)/n);

f:=(x,y) -> x+y

x:=x0:y:=y0:

This next step confuses me the most, my professor uses this syntax to compute the values of approximation via Euler's method. N represents the number of pieces we want to approximate the value with. X0 is initial and XF is final. 

forifrom1tondo k:=f(x,y):y:=y+h*k:x:=x+h:print(x,y):od:

I tried replicating this syntax on the exact same problem, copying the syntax commands word for word. Yet, I keep getting the same error "unable to parce" error, with the "od" being highlighted. But on her tutorial, it gave her an two columns with the intervals (n) and all it's values. She even did the same did for only wanting 1 loop printed 

forifrom1tondo k:=f(x,y):y:=y+h*k:x:=x+h:od:print(x,y):.   And it gave her only 1 loop.

I tried both and still got the error. Please Help, Thanks in advance

Hey, i'm trying do demonstrate that a nonlinear system has a semistable limit cycle but i get a warning at the plot command saying "Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct" and i dont understand it. So i wonder if someone here could help me? 

 

restart; with(PDEtools); with(plots);
eq1 := diff(x(t), t) = x(t)*(x(t)^2+y(t)^2-1)^2-y(t);
                                             2       
           d              /    2       2    \        
          --- x(t) = x(t) \x(t)  + y(t)  - 1/  - y(t)
           dt                                        
eq2 := diff(y(t), t) = y(t)*(x(t)^2+y(t)^2-1)^2+x(t);
                                             2       
           d              /    2       2    \        
          --- y(t) = y(t) \x(t)  + y(t)  - 1/  + x(t)
           dt                                        
tr := {x(t) = r(t)*cos(theta(t)), y(t) = r(t)*sin(theta(t))};
     {x(t) = r(t) cos(theta(t)), y(t) = r(t) sin(theta(t))}
eq1b := dchange(tr, x(t)*eq1+y(t)*eq2, [r(t), theta(t)], simplify);
              / d      \       2 /        4         2\
         r(t) |--- r(t)| = r(t)  \1 + r(t)  - 2 r(t) /
              \ dt     /                              
eq1b := expand(eq1b/r(t));
                d                    5         3
               --- r(t) = r(t) + r(t)  - 2 r(t) 
                dt                              
eq2b := dchange(tr, y(t)*eq1-x(t)*eq2, [r(t), theta(t)], simplify);
                      2 / d          \        2
                 -r(t)  |--- theta(t)| = -r(t) 
                        \ dt         /         
eq2b := simplify(eq2b/(-r(t)^2));
                         d              
                        --- theta(t) = 1
                         dt             
sol1 := dsolve({eq1b, r(0) = r[0]}, r(t));
          /      /  /     2  \                 
          |      |  | r[0]   |          2     2
r(t) = exp|RootOf|ln|--------| (exp(_Z))  r[0] 
          \      \  \r[0] - 1/                 

                           2     2
   - ln(r[0] + 1) (exp(_Z))  r[0] 

       /             2\                                       
       |(exp(_Z) - 1) |          2     2            2        2
   - ln|--------------| (exp(_Z))  r[0]  + (exp(_Z))  _Z r[0] 
       \ exp(_Z) - 2  /                                       

                                /     2  \              
                2     2         | r[0]   |             2
   + 2 (exp(_Z))  r[0]  t - 2 ln|--------| exp(_Z) r[0] 
                                \r[0] - 1/              

                                2
   + 2 ln(r[0] + 1) exp(_Z) r[0] 

         /             2\                                   
         |(exp(_Z) - 1) |             2                    2
   + 2 ln|--------------| exp(_Z) r[0]  - 2 exp(_Z) _Z r[0] 
         \ exp(_Z) - 2  /                                   

                           /     2  \           
                   2       | r[0]   |          2
   - 4 exp(_Z) r[0]  t - ln|--------| (exp(_Z)) 
                           \r[0] - 1/           

                                 /             2\           
                           2     |(exp(_Z) - 1) |          2
   + ln(r[0] + 1) (exp(_Z))  + ln|--------------| (exp(_Z)) 
                                 \ exp(_Z) - 2  /           

                                          /     2  \        
              2                   2       | r[0]   |        
   - (exp(_Z))  _Z - 2 t (exp(_Z))  + 2 ln|--------| exp(_Z)
                                          \r[0] - 1/        

                                  /             2\        
                                  |(exp(_Z) - 1) |        
   - 2 ln(r[0] + 1) exp(_Z) - 2 ln|--------------| exp(_Z)
                                  \ exp(_Z) - 2  /        

              2                                    2            
   - (exp(_Z))  + 2 _Z exp(_Z) + 4 t exp(_Z) + r[0]  + 2 exp(_Z)

      \\    
      ||    
   - 1|| - 1
      //    
sol1 := simplify(sol1);
          /      /   /     2  \                
          |      |   | r[0]   |               2
r(t) = exp|RootOf|-ln|--------| exp(2 _Z) r[0] 
          \      \   \r[0] - 1/                

                                2
   + ln(r[0] + 1) exp(2 _Z) r[0] 

       /             2\                                     
       |(exp(_Z) - 1) |               2                    2
   + ln|--------------| exp(2 _Z) r[0]  - exp(2 _Z) _Z r[0] 
       \ exp(_Z) - 2  /                                     

                               /     2  \              
                     2         | r[0]   |             2
   - 2 exp(2 _Z) r[0]  t + 2 ln|--------| exp(_Z) r[0] 
                               \r[0] - 1/              

                                2
   - 2 ln(r[0] + 1) exp(_Z) r[0] 

         /             2\                                   
         |(exp(_Z) - 1) |             2                    2
   - 2 ln|--------------| exp(_Z) r[0]  + 2 exp(_Z) _Z r[0] 
         \ exp(_Z) - 2  /                                   

                           /     2  \          
                   2       | r[0]   |          
   + 4 exp(_Z) r[0]  t + ln|--------| exp(2 _Z)
                           \r[0] - 1/          

                                /             2\          
                                |(exp(_Z) - 1) |          
   - ln(r[0] + 1) exp(2 _Z) - ln|--------------| exp(2 _Z)
                                \ exp(_Z) - 2  /          

                                        /     2  \        
                                        | r[0]   |        
   + exp(2 _Z) _Z + 2 t exp(2 _Z) - 2 ln|--------| exp(_Z)
                                        \r[0] - 1/        

                                  /             2\        
                                  |(exp(_Z) - 1) |        
   + 2 ln(r[0] + 1) exp(_Z) + 2 ln|--------------| exp(_Z)
                                  \ exp(_Z) - 2  /        

                                                  2            
   + exp(2 _Z) - 2 _Z exp(_Z) - 4 t exp(_Z) - r[0]  - 2 exp(_Z)

      \\    
      ||    
   + 1|| - 1
      //    
sol2 := dsolve({eq2b, theta(0) = theta[0]}, theta(t));
                    theta(t) = t + theta[0]
theta[0] := (1/4)*Pi;
                              1   
                              - Pi
                              4   
plot1 := polarplot([subs(r[0] = .1, rhs(sol1)), rhs(sol2), t = 0 .. 10], color = red);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
plot2 := polarplot([subs(r[0] = 2, rhs(sol1)), rhs(sol2), t = 0 .. 10], color = blue);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
display({plot1, plot2}, scaling = constrained, tickmarks = [4, 3], view = [-2 .. 2, -2 .. 2]);

I am tying to compute the wronskian of a fourth order DE: y=C1e2x+ C2e-x +C3xe-x+ C4x2e-x Here's what I did:

with(VectorCalculus):
with(LinearAlgebra):

Determinant(Wronskian([e^(2*x), e^(-x), xe^(-x), x^2*e^(-x)], x)):

which gave nothing.
Can anyone please help?

Thanks in advance,

AJ

Hi, there!

I try to simplify the next expression:

Simplify(LeviCivita[4, sigma, lambda, rho]*LeviCivita[4, xi, eta, mu]*g_[rho, mu]*qp[sigma]*q[lambda]*qp[xi]*q[eta])

Maple gives answer:

In reality it is incorrect answer, because indices must run over 1,2,3 but not 1,2,3,4!

SumOverRepeatedIndices(%) confirms that maple mistakes.

 

my preamble is:

with(Physics)

Setup(mathematicalnotation = true);
Coordinates(X);

Setup(spaceindices = lowercaselatin)

Setup(tensors = q[mu](X))

PDEtools:-declare(q(X))

Setup(tensors = qp[mu](X))

PDEtools:-declare(qp(X))

I use Ubuntu 14.04 and X, not the desktop.  I use emacs/maple 2016.

GNU Emacs 25.1.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2017-03-1

;;; maplev.el --- Maple mode for GNU Emacs

;; Authors:    Joseph S. Riel <joer@k-online.com>
;;             and Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
;; Time-stamp: "2003-10-09 22:49:16 joe"
;; Created:    June 1999
;; Version:    2.155
;; Keywords:   Maple, languages
;; X-URL:      http://www.k-online.com/~joer/maplev/maplev.html
;; X-RCS:      $Id: maplev.el,v 1.14 2006-06-02 14:02:38 joe Exp $

I use emacs/maple mode with maple 2016.  Quite often, emacs looses connection with the maple server.  I do  not remember this happening or maybe not as often, with earlier versions of maple.

After using maple/emacs, I started xmaple.  After a few expression evaluations, the maple server stopped.  Restarting xmaple and repeating the expression evaluations many times, I do not get the crash.  So, this appears to be a difficulty with external connections to the maple server.

Does a later version of maple mode exist?

 

I expected plot with an undefined name to do nothing, but,

plot(asdf);

actually plots y=x!

When I right click on an expression, I only some times get the context menu (under Maple 2016 in document mode, in Win 10).

Any suggestions - Anyone else having this problem? - I know how to use the long forms, but this is for students - for a brief exposure to Maple.

hi

how i can remove this error?

thanks

Error, (in pdsolve/numeric/process_IBCs) initial/boundary conditions can only contain derivatives which are normal to the boundary, got (D[1](H))(x, 0)
 

RR-steady.mw


 

 

"restart;beta:=1:k:=2:L:=1: W(t):=(Heaviside(t-1)-Heaviside(t-1.1)); theta:=3:   hR:=1 :hD(x):=hR+tan(theta)*(L-x) :W0:=2: f(x):=sqrt((hR^(2)+(W0)/(k)*(L^(2)-x^(2)))):t:=5:M:=2:theta:=20:"

proc (t) options operator, arrow; Heaviside(t-1)-Heaviside(t-1.1) end proc

(1)

PDE1 := diff(H(x, y), x, x)+diff(H(x, y), y, y)+2*W(t)/k = 0

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

(2)

bcs1 := {H(L, y) = hR^2, (D[1](H))(0, y) = 0};

{H(1, y) = 1, (D[1](H))(0, y) = 0}

(3)

bcs2 := {H(x, M) = hD(x)^2, (D[1](H))(x, 0) = 0}

{H(x, 2) = (1+tan(20)*(1-x))^2, (D[1](H))(x, 0) = 0}

(4)

pdsolve(PDE1, `union`(bcs1, bcs2), numeric)

Error, (in pdsolve/numeric/process_IBCs) initial/boundary conditions can only contain derivatives which are normal to the boundary, got (D[1](H))(x, 0)

 

``


 

Download RR-steady.mw

4 5 6 7 8 9 10 Last Page 6 of 37