## 1400 Reputation

19 years, 21 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

## Compare with exact solution:...

(1) Y_vals produces a list of y(x), for x=0, 0.1, 0.2, ..., 1.0.

(2) Comparison exact and numeric solution:

`restart;DE := (x+b*y(x))*diff(y(x),x) + y(x) = 0;BC := y(1)=1:b := 1/10:# exact solution:sol1 := dsolve( {DE,BC}, y(x) ): Y1 := unapply( subs( sol1, y(x) ), x );# numeric solution:sol := dsolve( {DE,BC}, y(x), numeric, output=listprocedure ):Y := subs( sol, y(x) ):# comparison exact and numeric sulutionplot( Y1-Y, 0..1 );`

## Explanation...

Notice that in the display statement you must provide the plots as a sequence or list. If you use a set:

plots:-display]( {A,B,C,E}, ...

the plots, and consequentlly the corresponding legends, are put in random order.

## Explanation...

Notice that in the display statement you must provide the plots as a sequence or list. If you use a set:

plots:-display]( {A,B,C,E}, ...

the plots, and consequentlly the corresponding legends, are put in random order.

## Continuation...

... and if you want a plot of the derivative dpH/dVb:

`plot( [VB,1/diff(VB,ph), ph=ph0..ph40], labels=["Vb",typeset(Diff(pH,Vb))] );`

## Continuation...

... and if you want a plot of the derivative dpH/dVb:

`plot( [VB,1/diff(VB,ph), ph=ph0..ph40], labels=["Vb",typeset(Diff(pH,Vb))] );`

## remove B := 'B':...

@emma hassan If you want to use the assigned valies of the table B in the matrix, you have to remove the unassign command B := 'B':

## remove B := 'B':...

@emma hassan If you want to use the assigned valies of the table B in the matrix, you have to remove the unassign command B := 'B':

## You are right.....

@Carl Love I was trihggered by the words  "Existence and uniqueness" , which leads me automatically to IVP's!

## You are right.....

@Carl Love I was trihggered by the words  "Existence and uniqueness" , which leads me automatically to IVP's!

## rsolve or for-loop?...

@fias In this special case the for-loop is (perhaps the most) efficient.

But I supposed that your problem (because it is easily done by hand) was a simple example of more complicated recurrence equations.

## rsolve or for-loop?...

@fias In this special case the for-loop is (perhaps the most) efficient.

But I supposed that your problem (because it is easily done by hand) was a simple example of more complicated recurrence equations.

## Bug?...

Thank you, Carl, this helps.
I think it is not a bug, bacause when the function is not one-to-one there can be multiple solutions:

h := piecewise( x<1,x,x-1): solve(h=y,x): lprint(%);
piecewise(y < 0, [y], y < 1, [1+y, y], 1 <= y, [1+y])

## Bug?...

Thank you, Carl, this helps.
I think it is not a bug, bacause when the function is not one-to-one there can be multiple solutions:

h := piecewise( x<1,x,x-1): solve(h=y,x): lprint(%);
piecewise(y < 0, [y], y < 1, [1+y, y], 1 <= y, [1+y])

## Q is a list....

(1) In the procedure Basisvector you initialize num6 als a number. This has to be a Vector:

`BasisVector := proc(a, b, num)  local result6, i;  result6 := Vector(num);  for i from 1 to num do    result6[i] := 0;  od;  for i from 1 to num do    result6[i] := Basis(convert(a(i, 1 .. -1),list), b);  od;  return result6;end proc;`

(2) Now we can see what Q is:

` BasisVector(<g1|g2|g3|g4|g5>, tdeg(x, y, h121, h122, h123, h124, h125), 2),tdeg(x, y, h121, h122, h123, h124, h125),'Q',2):lprint(Q);[-h124*y^3-h124*y-h125*x+h125*y-h121+1]`

So Q is a list, not a rtable!

` nops(Q);                               1`

## Q is a list....

(1) In the procedure Basisvector you initialize num6 als a number. This has to be a Vector:

`BasisVector := proc(a, b, num)  local result6, i;  result6 := Vector(num);  for i from 1 to num do    result6[i] := 0;  od;  for i from 1 to num do    result6[i] := Basis(convert(a(i, 1 .. -1),list), b);  od;  return result6;end proc;`

(2) Now we can see what Q is:

` BasisVector(<g1|g2|g3|g4|g5>, tdeg(x, y, h121, h122, h123, h124, h125), 2),tdeg(x, y, h121, h122, h123, h124, h125),'Q',2):lprint(Q);[-h124*y^3-h124*y-h125*x+h125*y-h121+1]`

So Q is a list, not a rtable!

` nops(Q);                               1`
 2 3 4 5 6 7 8 Page 4 of 11
﻿