## 14453 Reputation

11 years, 269 days

## MaplePrimes Activity

### These are answers submitted by Kitonum

In fact, after calculating the derivatives, we get a linear system:

 >
 >
 (1)
 >
 (2)
 >
 (3)
 >

## multiplication sign...

y = x*(x^4 - 10*x^2 + 39)/30

## Statistics:-NonlinearFit...

For best results, I replaced the constant  2  with a third parameter  a3 . We specify the segment  [a,b]  and the step  h  to obtain data  X  and  Y  and then use the  Statistics:-NonlinearFit  command. When reducing the segment  [a,b] , we get better results:

 > restart; a, b:=0, 5: f1:=x->(2*x)/(3+5*x):   f2:=x->a1*(a3-exp(-a2*x)): h:=0.1: n:=(b-a)/h; X:=[seq(i*h,i=0..n)]; Y:=[seq(f1(i*h),i=0..n)]; F:=Statistics:-NonlinearFit(f2(x), X, Y, x); plot([f1(x),F], x=0..5, color=[blue,red],legend=["f1","f2"]);
 > a, b:=0, 2: h:=0.1: n:=(b-a)/h; X:=[seq(i*h,i=0..n)]; Y:=[seq(f1(i*h),i=0..n)]; F:=Statistics:-NonlinearFit(f2(x), X, Y, x); plot([f1(x),F], x=0..2, color=[blue,red],legend=["f1","f2"]);
 >

Edit.

## plot...

Here is another way. The first and second points almost coincide, so they block one another:

```restart;
plot([[[28,.6481496576]],[[28, .648149657615473]],[[28, .6512873548]]],style='point',color=["Blue","Orange","Red"], symbol=solidcircle, symbolsize=12, labels = ["k", "y(k)"], legend = ["10-digit precision", "15-digit precision", "Floating-point iteration"] ,legendstyle = [font = ["HELVETICA", 9], location = right]);
```

## Single quotes...

Use single quotes for single use (in 2d math only):

`'a >= b'`

## A way...

Example:

`-%int(x^2,x);`

## Not bug but a design...

I think this is not a bug, but just such a design in Maple 2015. In subsequent versions of Maple, this command has been improved (the word  parameters  can be omitted). For example, in Maple 2018.2, the following code works correctly:

```y := [1, 3, 8];
val := r->y[r]:
Explore(val(r), r=1..3);
```

## Short way...

 > diff(F(x(t),y(t)),t)=0;
 (1)
 >

## Workaround...

In  display(L2,L22,L3,L1)  the previously recorded polygon  L2  closes the later recorded polygon  L22, but L1  and  L3  always lie higher (in Maple 2018.2). See the workaround below:

```restart;
with(plots):
L1 := textplot([2, 2, "Polygon"], color = white, font=[times,bold,16]):
L2 := plottools:-polygon([[0, 0], [3, 4], [3, 1]], color = red):
L22 := plottools:-polygon([[0, 0], [0.5, 2], [1,0]], color = green):
L3 := contourplot(x^2 + y^2, x = 1 .. 1.5, y = 4/3*x..2):

display(L2,L22,L3,L1);
```

## plots:-inequal...

The  coords=polar  option doesn't seem to work (in Maple 2018.2), so I used Cartesian coordinates.
3 regions are plotted:

```A:=plots:-inequal({sqrt(x^2+y^2)<2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)>3},x=-3.3..4.3,y=-4.3..4.3, color=green):
B:=plots:-inequal({sqrt(x^2+y^2)>2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)<3},x=-3.3..4.3,y=-4.3..4.3, color=blue):
C:=plots:-inequal({sqrt(x^2+y^2)<2+2*x/sqrt(x^2+y^2),sqrt(x^2+y^2)<3},x=-3.3..4.3,y=-4.3..4.3, color=red):
plots:-display(<A | B | C>, scaling=constrained);
```

## y(x)=C*sin(n*Pi*x) only for A=0...

We can get a general solution to your problem for an integer  n , if we first solve without initial conditions, and then impose these conditions and solve the corresponding system. We see that there is an infinite family of solutions  y(x)=C*sin(n*Pi*x)  (С is an any constant)  only if  A = 0. There are no any solutions if  A <> 0 .

 > restart; ode := diff(y(x), x, x) + (n*Pi)^2*y(x) = A^3*sin(n*Pi*x)^3; dsol1 := dsolve(ode); Y:=eval(y(x),dsol1); Sys:={eval(Y,x=0)=0, eval(Y,x=1)=0}; simplify(eval(op(2,Sys),_C1=0)) assuming n::integer; solve(%, A,dropmultiplicity);
 (1)
 >

It is easy to achieve good visibility by simple means. I changed the style of the surfaces, removing the lines, each plane made in different colors and a few more minor changes. The solution itself is depicted as a bold red dot:

```restart; with(plots):
sys := [p+x+.6*y-15, p+.3*x+.2*y-10, p+.5*x+y-14]:
sol:=solve(sys, [x, y, p])[];
A:=implicitplot3d(sys, x = 0 .. 10, y = 0 .. 10, p = 0 .. 10, style=surface, color=["LightBlue","LightGreen","Yellow"]):
B:=pointplot3d(eval([x,y,p],sol), color=red, symbol=solidsphere, symbolsize=15):
display(A,B, axes=normal, orientation=[-20,80], lightmodel=light4);
```

Should be:

```restart;

M:=Matrix(10, 10, [[1, 0, 0, 0, 1/2, 0, 0, 0, 0, 0], [0, 1/2, 0, 0, 0, 0, 0, 1/3, 0, 0], [0, 0, 1/2, 0, 0, 0, 0, 0, 1/3, 0], [0, 0, 0, 1/3, 0, 0, 0, 0, 0, 0], [1/2, 0, 0, 0, 1/3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1/3, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1/4, 0, 0, 0], [0, 1/3, 0, 0, 0, 0, 0, 1/4, 0, 0], [0, 0, 1/3, 0, 0, 0, 0, 0, 1/4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1/4]]);

B:=Matrix(10, 5, [[0, 0, 1/3, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1/4, 0, 0, 0], [0, 0, 1/4, 0, 0], [0, 0, 0, 1/4, 0], [1/2, 1/2, 1, 0, 0], [1, 1/2, 1/2, 1, 0], [0, 1, 1/2, 1/2, 1], [0, 0, 1, 1/2, 1/2]]);

B^%T.M^(-1).B;```

## Procedure for the collocation method...

 > restart; Collocation:=proc(Equation,dependent_variable,range,N) local x, _f, a, b, h, P, Eq1, x0, Sys; x:=op(1,dependent_variable); _f:=op(0,dependent_variable); a:=op(1,rhs(range)); b:=op(2,rhs(range)); h:=(b-a)/N; assign(seq(x0[i]=a+i*h, i=0..N)); P:=unapply(add(c[k]*x^k, k=0..N),x); Eq1:=eval(Equation,_f=P); Sys:={seq(eval(Eq1,x=x0[i]),i=0..N)}; solve(Sys,{seq(c[k],k=0..N)}); eval(`+`(seq(c[k]*x^k, k=0..N)), %); end proc:

Example of use

 > Digits:=20: # Solution by Collocation method P:=unapply(Collocation(Z(x)=3/2-9/2*exp(-2*x)-9/2*exp(-x)+1/2*int(exp(-y)*Z(x-y),y=0..ln(2)),Z(x),x=1.5..3.5,10),x); # Exact solution F:=x->-9*exp(-2*x)+9*exp(-x)/(ln(2)-2)+2; # Comparison of both solutions plot([P,F],0..5, color=[red,blue]); [seq(P(x)-evalf(F(x)), x=1.5..3.5,0.1)];
 (1)
 (2)
 >

## surd...

If you work in the real domain then replace  (y^3)^(2/3)  with  surd((y^3)^2, 3) (see help on the surd command for details). Then we see that the result is true for  y<0  as well:

```expr:=-1/6*(y^6-6*y^3*ln(x)+9*ln(x)^2)*y^2/surd((y^3)^2,3);
simplify(expr) assuming y>0;
simplify(expr) assuming y<0;
```

 3 4 5 6 7 8 9 Last Page 5 of 227
﻿