Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello everybody

can anybody help me solve this differential equation please?

 

d^2y(t)/dt^2-dy(t)/dt*1/y(t)=a*y(t)^2

I am really not good at writing the code. The code was from the book (Stochastic process with maple).

It does not seem to generate the different plots when I run the code.

Also the last added code was from the book but it shows error.

Thank you for the help in advance. (My English also is not good.)
 

restart

with(stats)

with(plots)

RandWalk := proc (N, p, q, sa, sb, M) local A, B, r, PA, PC, PB, state, step, path; A := -N; B := N; r := 1-p-q; PA := empirical[0., sa, 1-sa]; PC := empirical[q, r, p]; PB := empirical[1-sb, sb, 0.]; state := 0; path := state; to M do if A < state and state < B then step := trunc(stats[random, PC](1))-2 elif state = A then step := trunc(stats[random, PA](1))-2 elif state = B then step := trunc(stats[random, PB](1))-2 end if; state := state+step; path := path, state end do; plots[pointplot]([seq([i, path[i]], i = 1 .. nops([path]))], axes = BOXED) end proc

RandWalk(3, .5, .5, .8, .8, 20)

 

plots[display]([seq(RandomWalk(10, .45, .5, .8, 300), k = 1 .. 4)], insequence = true); plots[display](%)

Error, (in plots:-display) cannot make plot structure from object with name RandomWalk

 

 

``


 

Download randomWalk.mw
 

restart

with(stats)

with(plots)

RandWalk := proc (N, p, q, sa, sb, M) local A, B, r, PA, PC, PB, state, step, path; A := -N; B := N; r := 1-p-q; PA := empirical[0., sa, 1-sa]; PC := empirical[q, r, p]; PB := empirical[1-sb, sb, 0.]; state := 0; path := state; to M do if A < state and state < B then step := trunc(stats[random, PC](1))-2 elif state = A then step := trunc(stats[random, PA](1))-2 elif state = B then step := trunc(stats[random, PB](1))-2 end if; state := state+step; path := path, state end do; plots[pointplot]([seq([i, path[i]], i = 1 .. nops([path]))], axes = BOXED) end proc

RandWalk(3, .5, .5, .8, .8, 20)

 

plots[display]([seq(RandomWalk(10, .45, .5, .8, 300), k = 1 .. 4)], insequence = true); plots[display](%)

Error, (in plots:-display) cannot make plot structure from object with name RandomWalk

 

 

``


 

Download randomWalk.mw

 


Could you help me?

restart

with(stats)

with(plots)

"RandWalk :=proc(N,p,q,sa,sb,M)  local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

Error, unterminated procedure

"RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

 

``


 

Download randomWalk.mw
 

restart

with(stats)

with(plots)

"RandWalk :=proc(N,p,q,sa,sb,M)  local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

Error, unterminated procedure

"RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path:  A:=-N: B:=N: r:=1-p-q:  PA:=empirical[0.,sa,1-sa]:  PC:= empirical[q,r,p]:  PB := empirical[1-sb,sb,0.]:  state:=0: path:=state:  from 1 to M do  if (A< state and state <B) then step:=trunc(stats[random, PC](1))-2:  else if state =A then step:= trunc(stats[random,PA](1))-2:  else if state =B then step:= trunc(stats[random,PB](1))-2:  end if:  state := state + step:  path := path,state:  end do:  plots[pointplot]([seq([i,path[i]],i=1..nops([path]))],axes=BOXED):  end proc:"

 

``


 

Download randomWalk.mw

 

restart; with(stats); with(plots); RandWalk :=proc(N,p,q,sa,sb,M) local A,B,r,PA,PC,PB, state,step,path: A:=-N: B:=N: r:=1-p-q: PA:=empirical[0.,sa,1-sa]: PC:= empirical[q,r,p]: PB := empirical[1-sb,sb,0.]: state:=0: path:=state: from 1 to M do if (A< state and state

with(LinearAlgebra):
assign(seq(U || i = `<,>`(x[i], y[i]), i = 1 .. 3));
U || 4 := U || 1; r := (1/6)*sqrt(3);
assign(seq(V || i = (U || i+U || (i+1))*(1/2)+(`<,>`(`<|>`(0, 1), `<|>`(-1, 0)) . (U || (i+1)-U || i))*r, i = 1 .. 3)); Norm(V || 3-V || 1, 2); is(Norm(V || 3-V || 1, 2) = Norm(V || 3-V || 2, 2)); is(Norm(V || 2-V || 1, 2) = Norm(V || 3-V || 2, 2));

Starting from 3 points of a base, then got 3 lines equations.

If having 3 lines equations of a cone surface, how to find the surface equation of a cone?

 


 

Solving a Numbrix Puzzle with Logic

Background

 

 

Parade magazine, a filler in the local Sunday newspaper, contains a Numbrix puzzle, the object of which is to find a serpentine path of consecutive integers, 1 through 81, through a nine by nine grid.  The puzzle typically specifies the content of every other border cell.

 

The Maple Logic  package has a procedure, Satisfy , that can be used to solve this puzzle.  Satisfy is a SAT-solver; given a boolean expression it attempts to find a set of equations of the form {x__1 = b__1, x__2 = b__2, () .. ()}, where x__i are the boolean variables in the given expression and b__i are boolean values (true or false) that satisfy the expression (cause it to evaluate true).

 

A general technique to solve this and other puzzles with Satisfy is to select boolean-values variables that encode the state of the puzzle (a trial solution, whether valid or not), generate a boolean-expression of these variables that is satisfied (true) if and only if the variables are given values that correspond to a solution, pass this expression to Satisfy, then translate the returned set of boolean values (if any) to the puzzle solution.

Setup

 

Assign a matrix that defines the grid and the initial position.  Use zeros to indicate the cells that need values. To make it easy to inspect the expressions, a small 2 x 3 matrix is used for this demo---a full size example is given at the end.

M := Matrix(2,3, {(1,1) = 1, (1,3) = 5});

Matrix(2, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0})

(2.1)

 

Extract the dimensions of the Matrix

(m,n) := upperbound(M);

2, 3

(2.2)

Boolean Variables

 

Let the boolean variable x[i,j,k] mean that cell (i,j) has value k. For example, x[2,3,6] is true when cell (2,3) contains 6, otherwise it is false. There are (m*n)^2 boolean variables.

Initial Position

 

The initial position can be expressed as the following and-clause.

initial := &and(seq(seq(ifelse(M[i,j] = 0, NULL, x[i,j,M[i,j]]), i = 1..m), j = 1..n));

`&and`(x[1, 1, 1], x[1, 3, 5])

(4.1)

Adjacent Cells

 

The requirement that an interior cell with value k is adjacent to the cell with value k+1 can be expressed as the implication
   

   x[i,j,k] &implies &or(x[i-1,j,k+1], x[i+1,j,k+1], x[i,j-1,k+1], x[i,j+1,k+1])

 

Extending this to handle all cells results in the following boolean expression.

adjacent := &and(seq(seq(seq(
         x[i,j,k] &implies &or(NULL
                               , ifelse(1<i, x[i-1, j, k+1], NULL)
                               , ifelse(i<m, x[i+1, j, k+1], NULL)
                               , ifelse(1<j, x[i, j-1, k+1], NULL)
                               , ifelse(j<n, x[i, j+1, k+1], NULL)
                               )
                            , i = 1..m)
                        , j = 1..n)
                    , k = 1 .. m*n-1));

`&and`(`&implies`(x[1, 1, 1], `&or`(x[2, 1, 2], x[1, 2, 2])), `&implies`(x[2, 1, 1], `&or`(x[1, 1, 2], x[2, 2, 2])), `&implies`(x[1, 2, 1], `&or`(x[2, 2, 2], x[1, 1, 2], x[1, 3, 2])), `&implies`(x[2, 2, 1], `&or`(x[1, 2, 2], x[2, 1, 2], x[2, 3, 2])), `&implies`(x[1, 3, 1], `&or`(x[2, 3, 2], x[1, 2, 2])), `&implies`(x[2, 3, 1], `&or`(x[1, 3, 2], x[2, 2, 2])), `&implies`(x[1, 1, 2], `&or`(x[2, 1, 3], x[1, 2, 3])), `&implies`(x[2, 1, 2], `&or`(x[1, 1, 3], x[2, 2, 3])), `&implies`(x[1, 2, 2], `&or`(x[2, 2, 3], x[1, 1, 3], x[1, 3, 3])), `&implies`(x[2, 2, 2], `&or`(x[1, 2, 3], x[2, 1, 3], x[2, 3, 3])), `&implies`(x[1, 3, 2], `&or`(x[2, 3, 3], x[1, 2, 3])), `&implies`(x[2, 3, 2], `&or`(x[1, 3, 3], x[2, 2, 3])), `&implies`(x[1, 1, 3], `&or`(x[2, 1, 4], x[1, 2, 4])), `&implies`(x[2, 1, 3], `&or`(x[1, 1, 4], x[2, 2, 4])), `&implies`(x[1, 2, 3], `&or`(x[2, 2, 4], x[1, 1, 4], x[1, 3, 4])), `&implies`(x[2, 2, 3], `&or`(x[1, 2, 4], x[2, 1, 4], x[2, 3, 4])), `&implies`(x[1, 3, 3], `&or`(x[2, 3, 4], x[1, 2, 4])), `&implies`(x[2, 3, 3], `&or`(x[1, 3, 4], x[2, 2, 4])), `&implies`(x[1, 1, 4], `&or`(x[2, 1, 5], x[1, 2, 5])), `&implies`(x[2, 1, 4], `&or`(x[1, 1, 5], x[2, 2, 5])), `&implies`(x[1, 2, 4], `&or`(x[2, 2, 5], x[1, 1, 5], x[1, 3, 5])), `&implies`(x[2, 2, 4], `&or`(x[1, 2, 5], x[2, 1, 5], x[2, 3, 5])), `&implies`(x[1, 3, 4], `&or`(x[2, 3, 5], x[1, 2, 5])), `&implies`(x[2, 3, 4], `&or`(x[1, 3, 5], x[2, 2, 5])), `&implies`(x[1, 1, 5], `&or`(x[2, 1, 6], x[1, 2, 6])), `&implies`(x[2, 1, 5], `&or`(x[1, 1, 6], x[2, 2, 6])), `&implies`(x[1, 2, 5], `&or`(x[2, 2, 6], x[1, 1, 6], x[1, 3, 6])), `&implies`(x[2, 2, 5], `&or`(x[1, 2, 6], x[2, 1, 6], x[2, 3, 6])), `&implies`(x[1, 3, 5], `&or`(x[2, 3, 6], x[1, 2, 6])), `&implies`(x[2, 3, 5], `&or`(x[1, 3, 6], x[2, 2, 6])))

(5.1)

 

All Values Used

 

The following expression is true when each integer k, from 1 to m*n, is assigned to one or more cells.

allvals := &and(seq(seq(&or(seq(x[i,j,k], k=1..m*n)), i=1..m), j=1..n));

`&and`(`&or`(x[1, 1, 1], x[1, 1, 2], x[1, 1, 3], x[1, 1, 4], x[1, 1, 5], x[1, 1, 6]), `&or`(x[2, 1, 1], x[2, 1, 2], x[2, 1, 3], x[2, 1, 4], x[2, 1, 5], x[2, 1, 6]), `&or`(x[1, 2, 1], x[1, 2, 2], x[1, 2, 3], x[1, 2, 4], x[1, 2, 5], x[1, 2, 6]), `&or`(x[2, 2, 1], x[2, 2, 2], x[2, 2, 3], x[2, 2, 4], x[2, 2, 5], x[2, 2, 6]), `&or`(x[1, 3, 1], x[1, 3, 2], x[1, 3, 3], x[1, 3, 4], x[1, 3, 5], x[1, 3, 6]), `&or`(x[2, 3, 1], x[2, 3, 2], x[2, 3, 3], x[2, 3, 4], x[2, 3, 5], x[2, 3, 6]))

(6.1)

Single Value

 

The following expression is satisfied when each cell has no more than one value.

 single := &not &or(seq(seq(seq(seq(x[i,j,k] &and x[i,j,kk], kk = k+1..m*n), k = 1..m*n-1), i = 1..m), j = 1..n));

`&not`(`&or`(`&and`(x[1, 1, 1], x[1, 1, 2]), `&and`(x[1, 1, 1], x[1, 1, 3]), `&and`(x[1, 1, 1], x[1, 1, 4]), `&and`(x[1, 1, 1], x[1, 1, 5]), `&and`(x[1, 1, 1], x[1, 1, 6]), `&and`(x[1, 1, 2], x[1, 1, 3]), `&and`(x[1, 1, 2], x[1, 1, 4]), `&and`(x[1, 1, 2], x[1, 1, 5]), `&and`(x[1, 1, 2], x[1, 1, 6]), `&and`(x[1, 1, 3], x[1, 1, 4]), `&and`(x[1, 1, 3], x[1, 1, 5]), `&and`(x[1, 1, 3], x[1, 1, 6]), `&and`(x[1, 1, 4], x[1, 1, 5]), `&and`(x[1, 1, 4], x[1, 1, 6]), `&and`(x[1, 1, 5], x[1, 1, 6]), `&and`(x[2, 1, 1], x[2, 1, 2]), `&and`(x[2, 1, 1], x[2, 1, 3]), `&and`(x[2, 1, 1], x[2, 1, 4]), `&and`(x[2, 1, 1], x[2, 1, 5]), `&and`(x[2, 1, 1], x[2, 1, 6]), `&and`(x[2, 1, 2], x[2, 1, 3]), `&and`(x[2, 1, 2], x[2, 1, 4]), `&and`(x[2, 1, 2], x[2, 1, 5]), `&and`(x[2, 1, 2], x[2, 1, 6]), `&and`(x[2, 1, 3], x[2, 1, 4]), `&and`(x[2, 1, 3], x[2, 1, 5]), `&and`(x[2, 1, 3], x[2, 1, 6]), `&and`(x[2, 1, 4], x[2, 1, 5]), `&and`(x[2, 1, 4], x[2, 1, 6]), `&and`(x[2, 1, 5], x[2, 1, 6]), `&and`(x[1, 2, 1], x[1, 2, 2]), `&and`(x[1, 2, 1], x[1, 2, 3]), `&and`(x[1, 2, 1], x[1, 2, 4]), `&and`(x[1, 2, 1], x[1, 2, 5]), `&and`(x[1, 2, 1], x[1, 2, 6]), `&and`(x[1, 2, 2], x[1, 2, 3]), `&and`(x[1, 2, 2], x[1, 2, 4]), `&and`(x[1, 2, 2], x[1, 2, 5]), `&and`(x[1, 2, 2], x[1, 2, 6]), `&and`(x[1, 2, 3], x[1, 2, 4]), `&and`(x[1, 2, 3], x[1, 2, 5]), `&and`(x[1, 2, 3], x[1, 2, 6]), `&and`(x[1, 2, 4], x[1, 2, 5]), `&and`(x[1, 2, 4], x[1, 2, 6]), `&and`(x[1, 2, 5], x[1, 2, 6]), `&and`(x[2, 2, 1], x[2, 2, 2]), `&and`(x[2, 2, 1], x[2, 2, 3]), `&and`(x[2, 2, 1], x[2, 2, 4]), `&and`(x[2, 2, 1], x[2, 2, 5]), `&and`(x[2, 2, 1], x[2, 2, 6]), `&and`(x[2, 2, 2], x[2, 2, 3]), `&and`(x[2, 2, 2], x[2, 2, 4]), `&and`(x[2, 2, 2], x[2, 2, 5]), `&and`(x[2, 2, 2], x[2, 2, 6]), `&and`(x[2, 2, 3], x[2, 2, 4]), `&and`(x[2, 2, 3], x[2, 2, 5]), `&and`(x[2, 2, 3], x[2, 2, 6]), `&and`(x[2, 2, 4], x[2, 2, 5]), `&and`(x[2, 2, 4], x[2, 2, 6]), `&and`(x[2, 2, 5], x[2, 2, 6]), `&and`(x[1, 3, 1], x[1, 3, 2]), `&and`(x[1, 3, 1], x[1, 3, 3]), `&and`(x[1, 3, 1], x[1, 3, 4]), `&and`(x[1, 3, 1], x[1, 3, 5]), `&and`(x[1, 3, 1], x[1, 3, 6]), `&and`(x[1, 3, 2], x[1, 3, 3]), `&and`(x[1, 3, 2], x[1, 3, 4]), `&and`(x[1, 3, 2], x[1, 3, 5]), `&and`(x[1, 3, 2], x[1, 3, 6]), `&and`(x[1, 3, 3], x[1, 3, 4]), `&and`(x[1, 3, 3], x[1, 3, 5]), `&and`(x[1, 3, 3], x[1, 3, 6]), `&and`(x[1, 3, 4], x[1, 3, 5]), `&and`(x[1, 3, 4], x[1, 3, 6]), `&and`(x[1, 3, 5], x[1, 3, 6]), `&and`(x[2, 3, 1], x[2, 3, 2]), `&and`(x[2, 3, 1], x[2, 3, 3]), `&and`(x[2, 3, 1], x[2, 3, 4]), `&and`(x[2, 3, 1], x[2, 3, 5]), `&and`(x[2, 3, 1], x[2, 3, 6]), `&and`(x[2, 3, 2], x[2, 3, 3]), `&and`(x[2, 3, 2], x[2, 3, 4]), `&and`(x[2, 3, 2], x[2, 3, 5]), `&and`(x[2, 3, 2], x[2, 3, 6]), `&and`(x[2, 3, 3], x[2, 3, 4]), `&and`(x[2, 3, 3], x[2, 3, 5]), `&and`(x[2, 3, 3], x[2, 3, 6]), `&and`(x[2, 3, 4], x[2, 3, 5]), `&and`(x[2, 3, 4], x[2, 3, 6]), `&and`(x[2, 3, 5], x[2, 3, 6])))

(7.1)

Solution

 

Combine the boolean expressions into a a single and-clause and pass it to Satisfy.

sol := Logic:-Satisfy(&and(initial, adjacent, allvals, single));

{x[1, 1, 1] = true, x[1, 1, 2] = false, x[1, 1, 3] = false, x[1, 1, 4] = false, x[1, 1, 5] = false, x[1, 1, 6] = false, x[1, 2, 1] = false, x[1, 2, 2] = false, x[1, 2, 3] = false, x[1, 2, 4] = false, x[1, 2, 5] = false, x[1, 2, 6] = true, x[1, 3, 1] = false, x[1, 3, 2] = false, x[1, 3, 3] = false, x[1, 3, 4] = false, x[1, 3, 5] = true, x[1, 3, 6] = false, x[2, 1, 1] = false, x[2, 1, 2] = true, x[2, 1, 3] = false, x[2, 1, 4] = false, x[2, 1, 5] = false, x[2, 1, 6] = false, x[2, 2, 1] = false, x[2, 2, 2] = false, x[2, 2, 3] = true, x[2, 2, 4] = false, x[2, 2, 5] = false, x[2, 2, 6] = false, x[2, 3, 1] = false, x[2, 3, 2] = false, x[2, 3, 3] = false, x[2, 3, 4] = true, x[2, 3, 5] = false, x[2, 3, 6] = false}

(8.1)

Select the equations whose right size is true

sol := select(rhs, sol);

{x[1, 1, 1] = true, x[1, 2, 6] = true, x[1, 3, 5] = true, x[2, 1, 2] = true, x[2, 2, 3] = true, x[2, 3, 4] = true}

(8.2)

Extract the lhs of the true equations

vars := map(lhs, sol);

{x[1, 1, 1], x[1, 2, 6], x[1, 3, 5], x[2, 1, 2], x[2, 2, 3], x[2, 3, 4]}

(8.3)

Extract the result from the indices of the vars and assign to a new Matrix

S := Matrix(m,n):

for v in vars do S[op(1..2,v)] := op(3,v); end do:

S;

Matrix(2, 3, {(1, 1) = 1, (1, 2) = 6, (1, 3) = 5, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4})

(8.4)

Procedure

 

We can now combine the manual steps into a procedure that takes an initialized Matrix and fills in a solution.

Numbrix := proc( M :: ~Matrix, { inline :: truefalse := false } )

Example

 

Create the initial position for a 9 x 9 Numbrix and solve it.

P := Matrix(9, {(1,1)=11, (1,3)=7, (1,5)=3, (1,7)=81, (1,9)=77, (3,9)=75, (5,9)=65, (7,9)=55, (9,9)=53
               , (9,7)=47, (9,5)=41, (9,3)=39, (9,1)=37, (7,1)=21, (5,1)=17, (3,1)=13});

Matrix(9, 9, {(1, 1) = 11, (1, 2) = 0, (1, 3) = 7, (1, 4) = 0, (1, 5) = 3, (1, 6) = 0, (1, 7) = 81, (1, 8) = 0, (1, 9) = 77, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (3, 1) = 13, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 75, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (5, 1) = 17, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (5, 7) = 0, (5, 8) = 0, (5, 9) = 65, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0, (6, 7) = 0, (6, 8) = 0, (6, 9) = 0, (7, 1) = 21, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = 0, (7, 8) = 0, (7, 9) = 55, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = 0, (8, 8) = 0, (8, 9) = 0, (9, 1) = 37, (9, 2) = 0, (9, 3) = 39, (9, 4) = 0, (9, 5) = 41, (9, 6) = 0, (9, 7) = 47, (9, 8) = 0, (9, 9) = 53})

(10.1)

CodeTools:-Usage(Numbrix(P));

memory used=0.77GiB, alloc change=220.03MiB, cpu time=15.55s, real time=12.78s, gc time=3.85s

 

Matrix(9, 9, {(1, 1) = 11, (1, 2) = 10, (1, 3) = 7, (1, 4) = 81, (1, 5) = 3, (1, 6) = 4, (1, 7) = 81, (1, 8) = 78, (1, 9) = 77, (2, 1) = 12, (2, 2) = 9, (2, 3) = 8, (2, 4) = 7, (2, 5) = 6, (2, 6) = 5, (2, 7) = 80, (2, 8) = 79, (2, 9) = 76, (3, 1) = 13, (3, 2) = 14, (3, 3) = 27, (3, 4) = 28, (3, 5) = 71, (3, 6) = 72, (3, 7) = 73, (3, 8) = 74, (3, 9) = 75, (4, 1) = 16, (4, 2) = 15, (4, 3) = 26, (4, 4) = 29, (4, 5) = 70, (4, 6) = 69, (4, 7) = 68, (4, 8) = 67, (4, 9) = 66, (5, 1) = 17, (5, 2) = 18, (5, 3) = 25, (5, 4) = 30, (5, 5) = 61, (5, 6) = 62, (5, 7) = 63, (5, 8) = 64, (5, 9) = 65, (6, 1) = 20, (6, 2) = 19, (6, 3) = 24, (6, 4) = 31, (6, 5) = 60, (6, 6) = 59, (6, 7) = 58, (6, 8) = 57, (6, 9) = 56, (7, 1) = 21, (7, 2) = 22, (7, 3) = 23, (7, 4) = 32, (7, 5) = 43, (7, 6) = 44, (7, 7) = 49, (7, 8) = 50, (7, 9) = 55, (8, 1) = 36, (8, 2) = 35, (8, 3) = 34, (8, 4) = 33, (8, 5) = 42, (8, 6) = 45, (8, 7) = 48, (8, 8) = 51, (8, 9) = 54, (9, 1) = 37, (9, 2) = 38, (9, 3) = 39, (9, 4) = 40, (9, 5) = 41, (9, 6) = 46, (9, 7) = 47, (9, 8) = 52, (9, 9) = 53})

(10.2)

 

numbrix.mw

I find many tools about differential 

i had some differential ideal

how to use these tools to research what application can be applied with differential ideals I discovered?

Given a list of numeric value lists, calculate the average of each sub-data list

### I am writing a code for an Optimal control using pontryagins maximum principle. I have supplied all neccessary boundary conditions yet it fails to detect one of the conditions. It gives an error message whenever I run it.

I need guidance. Thank you

 

restart;
with(plots);
r := 3; r[1] := 3; k := 10; a := 0.2e-1; b := 0.1e-1; c := 0.1e-1; beta := 0.3e-1; alpha := 0.3e-1; m := 0.5e-1;
z := 40; q := 5; p := 100; T := 3;
sigma := 0.1e-1; k[1] := 10; rho := 0.5e-1;

u[1] := min(max(0, z), 1); z := (a*m*k*lambda[2](t)*x(t)*y(t)-lambda[1](t)*r*(1+b*x(t)+c*y(t))*x(t)*x(t))/(z*k*(1+b*x(t)+c*y(t))); u[2] := min(max(0, q), 1); q := -lambda[1](t)*beta*x(t)*s(t)/q; u[3] := min(max(0, p), 1); p := -(r[1]*lambda[3](t)*s(t)*s(t))/(p*k[1]);
NULL;
sys := diff(x(t), t) = r*x(t)*(1-(1-u[1])*x(t)/k)-a*m*x(t)*y(t)/(1+b*x(t)+c*y(t))-beta*(1-u[2])*x(t)*s(t), diff(y(t), t) = -alpha*y(t)+a*m*x(t)*y(t)/(1+b*x(t)+c*y(t)), diff(s(t), t) = sigma*s(t)+r[1]*s(t)*(1-(1-u[3])*s(t)/k[1])-rho*s(t)*y(t), diff(lambda[1](t), t) = -lambda[1](t)*(r-2*r*(1-u[1])*x(t)/k-a*y(t)*(1+c*y(t))/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t)))-beta*(1-u[2])*s(t))-lambda[2](t)*a*m*(1-u[1])*(1+c*y(t))*y(t)/((1+b*x(t)+c*y(t)) . (1+b*x(t)+c*y(t))), diff(lambda[2](t), t) = -lambda[1](t)*a*x(t)*(1+b*x(t))/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t)))+lambda[2](t) . (-alpha+(a*m*(1-u[1]) . (1+b*x(t)))*x(t)/((1+b*x(t)+c*y(t))*(1+b*x(t)+c*y(t))))+lambda[3](t)*rho*s(t), diff(lambda[3](t), t) = lambda[1](t)*beta*(1-u[2])*x(t)-lambda[1](t)*(r[1]-2*r[1]*(1-u[3])*s(t)/k[1]-sigma-rho*y(t)), x(0) = 10, y(0) = 20, s(0) = 10, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0;
p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = .1);
Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6
p2o := odeplot(p1, [t, y(t)], 0 .. 2, numpoints = 100, labels = ["Time (months)", " "*`badbiomass""spatina"""`], labeldirections = [horizontal, vertical], style = line, color = red, axes = boxed);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution
r := 3; r[1] := 3; k := 10; a := 0.2e-1; b := 0.1e-1; c := 0.1e-1; beta := 0.3e-1; alpha := 0.3e-1; m := 0.5e-1; sigma := 0.1e-1; k[1] := 10; rho := 0.5e-1;
z := 40; q := 5; p := 100; T := 3;

 


fun := diff(x(t), t) = r*x(t)*(1-x(t)/k)-a*m*x(t)*y(t)/(1+b*x(t)+c*y(t))-beta*x(t)*s(t), diff(y(t), t) = -alpha*y(t)+a*m*x(t)*y(t)/(1+b*x(t)+c*y(t)), diff(s(t), t) = sigma*s(t)+r[1]*s(t)*(1-s(t)/k[1])-rho*s(t)*y(t), x(0) = 10, y(0) = 20, s(0) = 10;
p2 := dsolve({fun}, type = numeric);
Error, (in f) unable to store 'HFloat(10.0)*r*(1-HFloat(10.0)/k)-HFloat(3.1538461538461537)' when datatype=float[8]
p2i := odeplot(p2, [t, y(t)], 0 .. 2, numpoints = 100, labels = ["Time(months)", " bad biomass"], labeldirections = [horizontal, vertical], style = line, axes = boxed, color = blue);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution
plots[display](p2i, p2o);
Error, (in plots:-display) expecting plot structure but received: p2i

 

 

 

 

We have just released an update to Maple, Maple 2019.1.

Maple 2019.1 includes corrections and improvement to the mathematics engine (including LPSolve, sum, statistics, and the Physics package),  visualization (including annotations and the Plot Builder), export to LaTeX (exporting output) and PDF (freezing on export), network licensing, MATLAB connectivity, and more.  We recommend that all Maple 2019 users install these updates.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2019.1 download page, where you can also find more details.

do math regex solver exist in this world?

expect to output a set of regex for pattern

and then use regex to generate condition or rules equations and then use sorting algorithm to find whether match all data

Hello!

How can I print steps of ReducedRowEchelonForm when i got martix with dimensions 6x7(augmented)?

With command Expand Steps occurs an error: 

ExpandSteps(ReducedRowEchelonForm(macierzA))

 

In Maple 2019 it is not possible to change to "1-D Math Input".

But it is possible to convert (right mouse->convert to-> 1D Math Input)

In this mode I get the following results:


> 6/2*(1 + 2);
                               9
> 6/2(1 + 2);
                               3
I have the feeling the 2nd result is wrong.
If I change to "Maple input", I get the following result:
> 6/2(1 + 2);
                               9
 
In this editor, where I write this post, it is possible to insert Maple Math.
If I enter there "6/2(1 + 2)", in the preview is written "3".
and
If I enter there "6/2(1 + 2+9)", in the preview is written "3".
 
The parser gives no error message, but a wrong result.
 
If I enter nonsense, there is the following message "You have entered an invalid Maple expression". 
 
Are you aware of this?
 
Question 1)
Maximize A + B <= 60
A - B = prime or 2^n
A or B can be prime or 2^n  * prime
A or B at least one of them is prime
Solve system for A and B
Question 2)
Maximize A + B + C <= 60
A - B = prime or 2^n 
B - C = prime or 2^n
A,B,C at least one of them is prime
A or B or C can be prime or 2^n * prime 
Solve system for A and B and C

I have not touched Maple in about 10 years and I'm back but apparently my Maple skills got quite a bit it rusty. I'm trying to plot a function but keep getting this warning and a blank graph:

"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"


Here is what I'm trying to do (put and call formulas for Black 76 model):

> with(Statistics);
> X := RandomVariable(Normal(0, 1));
> K := 150;
> r := 0.25e-1;
> s := .75;
> t := .5;
> d1 := f-> (log(f/K)+.5*s^2*t)/(s*sqrt(t)):

> d2 := f-> d1(f)-s*sqrt(t):
> c := f-> exp(-r*t)*(f*([CDF])(X, d1(f))-K*([CDF])(X, d2(f))) :
p := ->exp(-r*t)*(K*([CDF])(X, -d2(f))-f*([CDF])(X, -d1(f))):

All of the above work as intented:
> evalf(c(100)), evalf(p(100));

return the correct values. But I can't plot c( ) or p( ):

plot(c(f), f = 50 .. 100)

"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"

What am I doing wrong here? I will appreciate any help.

Thank you.

First 553 554 555 556 557 558 559 Last Page 555 of 2097