Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi all


I have the following ordinary differential equation, where all the parameter used are constant ( A,B,C,D,E,F,G,H).

Is there any technique gives a solution
diff(y(x), x$2)+(A/x+B/x^2+C)*(diff(y(x), x))+D*(diff(y(x), x))^2/x+E*(diff(y(x), x))^3+F/x+G/x^2+H/x^3 = 0;

 

 thanks for your help

Dear all;

I hope an idea to solve the following problem.

P(n,t): probability at time t

Lambda and mu : two given parameters ( can be fixed ), and we assure mu greater then lambda

 t : time parameter ( we can say that 0<= t <=T , and T fixed ) 

 for n an integrer  greater then 1 we have the following equation

eq := diff(P(n, t), t) = -(lambda+mu)*P(n, t)+lambda*P(n-1, t)+mu*P(n+1, t);
 

for n=0, we have

ics := diff(P(0, t), t) = -lambda*P(0, t)+mu*P(1, t);

How can we compute P(n,t) ,

is there an exact solution or a numerical method to get the value of P(n,t)

Then we plot( P(n,t),t=0..100) ;

 

Many thinks

 

 

 

 

 

Can somebody please help me with this assignment?
Struggling a bit with the Euler-method from task d) and further.


 

rand1 := rand(2 .. 9):

4

(1)

NULL

(a*sqrt(a*a^b))^(1/c)

16^(1/4)*2^(1/8)

(2)

"example a:=2;b:=6;c:=4; result 2 D output is ((2*sqrt(2*2^(6)))^(1/(4)))"

````

``

NULL

but*result*is*16^(1/4)*2^(1/8)

``

assume(x > 0)

sqrt(x^3*(x^(3/4)))

(x^(15/4))^(1/2)

(3)

``(15/8)*How*determine*x*exponent*is

``


 

Download luythua.mw

 

From the screenshot we see that Maple has correctly replaced a in the defintion of s. But it has not incorported v[B]. I was a SMath (free from internet) user and this was a simple operation.

Thanks for any advice.


SymbolicEval.mw

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  

First 750 751 752 753 754 755 756 Last Page 752 of 2219