Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

How do you can convert g into ?

Can you help me?

 

Hi

I am trying to evaluate a function that contains an infinite sum. I need to evaluate the integral to determine a CDF, and from that hopefully the inverse CDF in order to sample the corresponding PDF.

The sum comes from a 2F1 hypergeometric function, which I have written manually in the attached file.

Can anyone tell me if and how it is possible to evaluate this integral, with respect to x?

I have inserted an image below, but also the entire file :) Marginal2.mw

Thanks in advance.

 

Maple 2018 starts but block and hangs after the first imput.

Even after a clean install on a clean disk where there are no old files of maple.

My specs are: WIN10 pr 64/ I7 /16 GB/ SSD

Who has the same problem and a sollution?

Uxx + Uyy =0

      y is less than Pi,x is greater than 0

B.c are u(0,y)=0 , u(Pi,y)=sinh*Pi*cosy

              u(x,0)=sinx , u(x,Pi)=-sinhx

How can I compute MatrixInverse, MatrixMultiply and eigenvalues(eigenvectors) faster? are there any procedures or commands that can be used instead of those three command mentioned before to speed up calculations?

1.mw

In the above document, digits must be 30.

I want to know how to program a metric g_[ ]  so that entries are zero apart from the diagonal.
Basically I am using the physics package and can set it as arbitrary or can set it to be specific values but I just want arbitrary values across the diagonal. e.g
 

with(Physics);
Setup(mathematicalnotation = true);
                 [mathematicalnotation = true]

Setup(metric = arbitrary);
 [metric = {(1, 1) = _F1(X), (1, 2) = _F2(X), (1, 3) = _F3(X), (1, 4) = _F4(X), (2, 2) = _F5(X), (2, 3) = _F6(X),  (2, 4) = _F7(X),

(3, 3) = _F8(X), (3, 4) = _F9(X),  (4, 4) = _F10(X)}]

SO here I want to keep F1 F5 F8 and F10, thanks in advance!

THIS IS WHAT I TRIED:

 

with(Physics);
Setup(mathematicalnotation = true);
Setup(Coordinatesystem = (X = [x1, x2, x3, x4]), metric = f(dx1^2+dx2^2+dx3^2+dx4^2));
    * Partial match of  'Coordinatesystem' against keyword 

       'coordinatesystems'

  Default differentiation variables for d_, D_ and dAlembertian 

   are: (Xequals(x1,x2,x3,x4))
  Systems of spacetime Coordinates are: (Xequals(x1,x2,x3,x4))
Error, (in Physics:-Setup) expected definition of a metric as a tensorial algebraic expression with two free indices; received one with free indices {}

 

The attached worksheet shows how to evaluate and graphically analyze an autonomous first-order nonlinear recurrence with two dependent variables and multiple symbolic parameters. 

This worksheet shows how a small module that simply encapsulates the given information of a problem combined with some use statements can greatly facilitate the organization of one's work, can encapsulate the setting of parameter values, and can allow one to work with symbolic parameters.

Edit: In the first version of this Post, I forgot to include the qualifier "autonomous".  The system being autonomous substantially simplifies its treatment.
 

Autonomous first-order nonlinear recurrences with parameters and multiple dependent variables

Author: Carl Love <carl.j.love@gmail.com> 20-Oct-2018

 

The techniques used in this worksheet can be applied to most autonomous first-order nonlinear recurrences with multiple dependent variables and parameters.

 

This worksheet shows how a small module that simply encapsulates the given information of a problem combined with some use statements

• 

can greatly facilitate the organization of one's work,

• 

can encapsulate the setting of parameter values,

• 

can allow one to work with symbolic parameters.

 

A Problem from MaplePrimes: A discrete Lottka-Volterra population model is applied to an isolated island with a population of predators (foxes), R, and prey (rabbits), K. [Note that R is the foxes, not the rabbits! Perhaps this problem statement originated in another language.] The change over one time period is given by

K[n+1]:= K[n]*(-b*R[n]+a+1);  R[n+1]:= R[n]*(b*e*K[n]-c+1),

where a, b, c, e are parameters of the model. In this problem we will use a= 0.15, b= 0.01, c= 0.02, e= 0.01, when numeric values are needed.

 

a) Show that there exists an equilibrium (values of K[n] and R[n] such that K[n+1] = K[n] and R[n+1] = R[n]).

 

b) Write Maple code that solves the recurrence numerically. Assume that if any population is less than 0.5 then it has gone extinct and set the value to 0. Check that your program is idempotent at the equilibrium.

 

restart:

We begin by collecting all the given information (except for specific numeric values) into a module. The ModuleApply lets the user set the numeric values later.

 

For all two-element vectors used in this worksheet, K is the first value and R is the second value.

KandR:= module()
local
   a, b, c, e, #parameters

   #procedure that lets user set parameter values:
   ModuleApply:= proc({
       a::algebraic:= KandR:-a, b::algebraic:= KandR:-b,
       c::algebraic:= KandR:-c, e::algebraic:= KandR:-e
   })
   local k;
      for k to _noptions do thismodule[lhs(_options[k])]:= rhs(_options[k]) od;
      return
   end proc,

   Extinct:= (x::realcons)-> `if`(x < 0.5, 0, x) #force small, insignificant values to 0
;
export
   #Procedure that does one symbolic iteration
   #(Note that this procedure uses Vector input and output.)
   iter_symb:= KR-> KR *~ <-b*KR[2]+a+1, b*e*KR[1]-c+1>, 

   #Such simple treatment as above is only possible for autonomous
   #recurrences.

  
   iter_num:= Extinct~@iter_symb #one numeric iteration
;
end module:

#The following expression is the discrete equivalent of the derivative (or gradient).
#It represents the change over one time period.
P:= <K,R>:  
OneStep:= KandR:-iter_symb(P) - P

Vector(2, {(1) = K*(-R*b+a+1)-K, (2) = R*(K*b*e-c+1)-R})

#An equilibrium occurs when the gradient is 0.
Eq:= <K__e, R__e>:
Eqs:= solve({seq(eval(OneStep=~ 0, [seq(P=~ Eq)]))}, [seq(Eq)]);

[[K__e = 0, R__e = 0], [K__e = c/(b*e), R__e = a/b]]

#We're only interested here in nonzero solutions.
EqSol:= remove(S-> 0 in rhs~(S), Eqs)[];

[K__e = c/(b*e), R__e = a/b]

#Set parameters:
KandR(a= 0.15, b= 0.01, c= 0.02, e= 0.01);

#Show idempotency at equilibrium:
use KandR in Eq0:= eval(Eq, EqSol); print(Eq0 = iter_num(Eq0)) end use:

(Vector(2, {(1) = 200.0000000, (2) = 15.00000000})) = (Vector(2, {(1) = 200.0000000, (2) = 15.00000000}))

#procedure that fills a Matrix with computed values of a 1st-order recurrence.
#(A more-efficient method than this can be used for linear recurrences.)
#This procedure has no dependence on the module.
Iterate:= proc(n::nonnegint, iter, init::Vector[column])
local M:= Matrix((n+1, numelems(init)), init^+, datatype= hfloat), i;
   for i to n do M[i+1,..]:= iter(M[i,..]) od;
   M
end proc:

We want to see what happens if the initial conditions deviate slightly from the equilibrium. It turns out that any deviation (as long as the
initial values are still nonnegative!) will cause the same effect. I simply chose the deviation <7,2> because it was the smallest for which

the plot clearly showed what happens using the scale that I wanted to show the plot at. By using a finer scale, it is possible to see the

"outward spiral" efffect from even the tiniest deviation.

dev:= <7,2>:
use KandR in KR:= Iterate(1000, iter_num, Eq0 + dev) end use:

plot(
   [
       KR, #trajectory of population
       KR[[1,1],..], #1st point
       KR[-[1,1],..], #last point,
       <Eq0|Eq0>^+, #equilibrium
       #every 100th point (helps show time scale):
       KR[100*[$1..iquo(numelems(KR[..,1]), 100)-1], ..]
   ],
   #This group of options are all lists, each element of which corresponds
   #to one of the above components of the plot:
   style= [line, point$4],
   symbol= [solidcircle$4, soliddiamond],
   symbolsize= [18$4, 12],
   color= [black, green, red, brown, blue],
   thickness= [0$5],
   legend= [`pop.`, init, final, equilibrium, `100 periods`],

   #This group of options are lists, each element of which corresponds to one
   #coordinate axis (horizontal, then vertical).
   view= [0..max(KR[..,1]), 0..max(KR(..,2))],
   labels= [rabbits, foxes],
   labeldirections= [horizontal,vertical],
   size= [700,700], #measured in pixels

   #options applied to whole plot:
   labelfont= [TIMES, BOLDITALIC, 14],
   title= "Population of foxes and rabbits over time" "\n", titlefont= [TIMES,16],
   caption=
      "\n" "Choosing an initial point near the equilibrium causes"
      "\n" "outward spiraling divergence." "\n",
   gridlines= false
);
 

A fieldplot helps show what happens for any starting values. An arrow is drawn from each of a 2-D grid of point. The magnitude and direction of the arrow show the gradient (as a vector) in this case.

plots:-fieldplot(
   rtable_eval(OneStep),
   K= 0..max(KR[..,1]),  R= 0..max(KR[..,2]), grid= [16,16],

   #arrow-specific options:
   anchor= tail, fieldstrength= log, arrows= slim, color= "DarkGreen",

   #other options (same as any 2D plot):
   labels= [rabbits, foxes], labeldirections= [horizontal,vertical],
   labelfont= [TIMES, BOLDITALIC, 14],
   title= "One-step population changes from any point" "\n", titlefont= [TIMES,16],
   caption= "\n" "All trajectories spiral outward from the equilibrium." "\n",
   size= [700,700],
   gridlines= false
);

The above plot is computed only from the symbolic discrete gradient expression OneStep; it does not use the computed population values from the first plot. It only uses the maxima of those computed values to determine the length of the axes.

 

Conclusion: While this is interesting stuff mathematically, and makes for great plots, divergence from the equilibrium doesn't seem realistic to me.

 


 

Download FoxesAndRabbits.mw

I have a solution to a linear ODE which is very long and complicated.  The solition clearly has some parts which are repeated and so it would would be easiest to express those repeated parts as something simpler.

 

For example, suppose I had

 

x = (-b + sqrt(b^2 - 4*a*c) ) /2*a

 

What is the command to take x and do someting like

 

Z = sqrt(b^2 - 4*a*c)

 

x = (-b + Z)/2*a

 

 

 

 

when plotting a polar function in terms of r and theta, is there a way to animate it?  

For instance I want to animate u(r,theta)=rcos(theta) for theta between 0 and 2Pi.

i have to list 
a := sort([.17, .23, .33, .39, .39, .40, .45, .52, .56, .59, .64, .66, .70, .76, .77, .78, .95, .97, 1.02, 1.12, 1.19, 1.24, 1.59, 1.74, 2.92])

b:=[5,seq(0,i=1..19)]:

i want to make aloop on a  by saying that for i=1 eliminate b[1] from a then sort the remining elements of a 

then for i=2 eliminate b[2] from a then sort the rest elimant of a and so on  

Q1: In place of three statments like >a:=3: b:=4; c:=5, I have found from an example in this forum that one can use >(a,b,c):=(3,4,5). And I find this useful in some applications. Anyone know what version of Maple introduced this? I can find not referneces in the Maple books I have

Q2: Maple someimes gives 'naked' decimals when I use Numeric formatting. Any way of avoiding this. I would  like 0.25 not .25

Many thanks


 

`~`[int](convert(convert(series(x^x, x), polynom), list), x = 0 .. 1)

Can this sequence (produced above in list form) be displayed as 1, -1/2^2, 1/3^3, -1/4^4, 1/5^5 -1/6^6 etc.

That is with the powers unevaluated.

Hello,

What are the methods for writing code to the recursive matrix A  as follows?

Thanks.

 

When i am running a code in maple worksheet , one error is shown by maple. My code and error (in bold) is below


Instructional workheet for the FracSym package
G. F. Jefferson and J. Carminati


Read in accompanying packages: ASP, DESOLVII and initialise using the with command:

read `ASP v4.6.3.txt`:

DESOLVII_V5R5 (March 2011)(c), by Dr. K. T. Vu, Dr. J. Carminati and Miss G. 

   Jefferson

 The authors kindly request that this software be referenced, if it is used 

    in work eventuating in a publication, by citing the article:
  K.T. Vu, G.F. Jefferson, J. Carminati, Finding generalised symmetries of 

     differential equations
using the MAPLE package DESOLVII,Comput. Phys. Commun. 183 (2012) 1044-1054.

                                -------------
       ASP (November 2011), by Miss G. Jefferson and Dr. J. Carminati

 The authors kindly request that this software be referenced, if it is used 

    in work eventuating in a publication, by citing the article:
    G.F. Jefferson, J. Carminati, ASP: Automated Symbolic Computation of 

       Approximate Symmetries
    of Differential Equations, Comput. Phys. Comm. 184 (2013) 1045-1063.

with(ASP);
              [ApproximateSymmetry, applygenerator, commutator]
with(desolv);
[classify, comtab, defeqn, deteq_split, extgenerator, gendef, genvec, 

  icde_cons, liesolve, mod_eq, originalVar, pdesolv, reduceVar, reduceVargen, 

  symmetry, varchange]

Read in FracSym and initialise using the with command:
read `FracSym.v1.16.txt`;
       FracSym (April 2013), by Miss G. Jefferson and Dr. J. Carminati

 The authors kindly request that this software be referenced, if it is used 

    in work eventuating in a publication, by citing:
G.F. Jefferson, J. Carminati, FracSym: Automated symbolic computation of Lie 

   symmetries
of fractional differential equations, Comput. Phys. Comm. Submitted May 2013.

with(FracSym);
 [Rfracdiff, TotalD, applyFracgen, evalTotalD, expandsum, fracDet, fracGen, 

   split]


BASIC OPERATORS

The Riemann-Liouville fractional derivatives is expressed in "inert" form using the FracSym routine Rfracdiff.
The explicit formula for the form of these fractional derivatives may be found in I. Podlubny, Fractional differential equations: An introduction to fractional derivatives, fractional differential equations, some methods of their solution and some of their applications, San Diego, 1999.)

Rfracdiff(u(x, t),t,alpha);
                                alpha          
                             D[t     ](u(x, t))

If the fractional derivative is taken for a product, the generalised Leibnitz rule is used to express the result (the product operator used is &* and is non-commutative). 
Rfracdiff(u(x, t)&*v(x,t),t,alpha);
     infinity                                                          
      -----                                                            
       \                                                               
        )                          (alpha - n)              n          
       /     binomial(alpha, n) D[t           ](u(x, t)) D[t ](v(x, t))
      -----                                                            
      n = 0                                                            
Rfracdiff(v(x, t)&*u(x,t),t,alpha);
     infinity                                                          
      -----                                                            
       \                                                               
        )                          (alpha - n)              n          
       /     binomial(alpha, n) D[t           ](v(x, t)) D[t ](u(x, t))
      -----                                                            
      n = 0                                                            

Fractional derivatives of integer order revert to the MAPLE diff routine.

Rfracdiff(u(x, t)&*v(x,t),t,2);
         / d  / d         \\             / d         \ / d         \
         |--- |--- u(x, t)|| v(x, t) + 2 |--- u(x, t)| |--- v(x, t)|
         \ dt \ dt        //             \ dt        / \ dt        /

                      / d  / d         \\
            + u(x, t) |--- |--- v(x, t)||
                      \ dt \ dt        //


The FracSym rouine TotalD may also be used to find total derivatives. evalTotalD is then used to evaluate the result (in jet notation). For example, 

TotalD(xi[x](x, y),x,2);
                                2              
                             D[x ](xi[x](x, y))
evalTotalD([%],[y],[x]);
        [     / d             \      2 / d  / d             \\
        [y_xx |--- xi[x](x, y)| + y_x  |--- |--- xi[x](x, y)||
        [     \ dy            /        \ dy \ dy            //

               / d  / d             \\       / d  / d             \\]
           + 2 |--- |--- xi[x](x, y)|| y_x + |--- |--- xi[x](x, y)||]
               \ dy \ dx            //       \ dx \ dx            //]

EXAMPLE -  FINDING SYMMETRIES FOR A FRACTIONAL DE

Consider the fractional PDE from: R. Sahadevan, T. Bakkyaraj, Invariant analysis of time fractional generalized Burgers and Korteweg-de Vries equations, J. Math. Anal. Appl. 393 (2012) 341-347.

We use the Rfracdiff routine to express the 
                                    alpha
 fractional derivative with respect to t:
fde1:=Rfracdiff(u(x, t),t,alpha) = (diff(u(x, t), x,x))+n*(u(x, t))^p*(diff(u(x, t),  x));
        alpha             / d  / d         \\            p / d         \
     D[t     ](u(x, t)) = |--- |--- u(x, t)|| + n u(x, t)  |--- u(x, t)|
                          \ dx \ dx        //              \ dx        /

sys1:=[Rfracdiff(u(x, t),t,alpha) = (diff(v(x, t), x)), Rfracdiff(v(x, t),t,alpha) = -u(x, t)*diff(u(x, t),x)];
[   alpha              d              alpha                      / d         \]
[D[t     ](u(x, t)) = --- v(x, t), D[t     ](v(x, t)) = -u(x, t) |--- u(x, t)|]
[                      dx                                        \ dx        /]

We use the the FracSym routine fracDet to find the determining equations for the symmetry for fde1. 
NOTE: The fourth argument (some integer at least 1) corresponds to the number of terms to be "peeled off" from the sums which occur in the extended infintesimal function for the fractional derivative. A value of 2 provides a good balance between information for solution of determining equations and speed.

deteqs:=fracDet([sys1], [u, v],[x, t], 2, alpha=(0.1)..1);
Error, (in desolv/PickLHSDerivative) Cannot pick out the left hand side derivatives

Please suggest what problem it may be?
 

Hi everyone, I'm doing a thesis about a solar panel and to extract some parameters from measured data I woudl have to solve 

a set of 3 non-lineair equations. This is de code that I use to (try to) solve the equations.

restart;

;
q := 0.16021e-18;
k := 0.13865e-22;


NULL;
Ns := 28;
T := 273+27.82;
Isc := 2.07;
Voc := 19.45;
Impp := 1.88;
Vmpp := 15.32;
                           Rsh := 326
dvdi := -1.52;


Vt := n*k*T*Ns/q;

NULL;
f1 := Rs = -dvdi-Vt/(Io*exp(Voc/Vt));
f2 := Io = (Isc-Voc/Rsh)/(exp(Voc/Vt)-1);
                            /Impp Rs + Vmpp\   Impp Rs + Vmpp
   f3 := Impp = Isc - Io exp|--------------| - --------------
                            \      Vt      /        Rsh      

fsolve({f1, f2, f3}, {Io, Rs, n});

Though running this doesn't give me a solution. 

I do have a working extraction though which is the same equations but with other variables: 

restart;

NULL;
q := 0.16021e-18;
k := 0.13865e-22;


NULL;
Ns := 72;
T := 298;
Isc := 8.53;
Voc := 44.9;
Impp := 8.04;
Vmpp := 36.1;
Rsh := 401.934;
dvdi := -.48766;


Vt := n*k*T*Ns/q;

NULL;
f1 := Rs = -dvdi-Vt/(Io*exp(Voc/Vt));
f2 := Io = (Isc-Voc/Rsh)/(exp(Voc/Vt)-1);
f3 := Impp = Isc-Io*(exp((Impp*Rs+Vmpp)/Vt)-1)-(Impp*Rs+Vmpp)/Rsh;

fsolve({f1, f2, f3}, {Io, Rs, n});

I'm am wondering why the first code doesn't give me a solution? I would guess that there is certainly a solution. Also when I slightly increase /  decrease a certain variable it can suddenly give/find a solution.

Could someone clear this out ?

 

Kind regards, Sven!

First 629 630 631 632 633 634 635 Last Page 631 of 2097