Kitonum

21500 Reputation

26 Badges

17 years, 60 days

MaplePrimes Activity


These are answers submitted by Kitonum

I did not find the color option for  title . As a workaround you can use  plots:-textplot  command:

A := plot(f(x), x = 0 .. 10, thickness = 3, gridlines = true): 
B := textplot([4.8, .22, "Fonction densité de χ^2\navec 3. d.d.l"], font = [ARIAL, bold, 14], color = red): 
display(A, B, size = [500, 500]);

 

To improve visibility, I reduced the ranges along the axes and used the size option:

with(DEtools)

diff(y(x), x) = x-y(x)

diff(y(x), x) = x-y(x)

(1)

A := DEplot(diff(y(x), x) = x-y(x), y(x), x = -3.5 .. 3.5, y = -3.5 .. 3.5, [y(0) = -1, y(1) = -1, y(2) = -1]); B := plot([-1, [0, t, t = -1 .. 0], [1, t, t = -1 .. 0], [2, t, t = -1 .. 0]], x = -3.5 .. 3.5, linestyle = [1, `$`(3, 3)], color = blue); plots:-display(A, B, size = [900, 500])

 

NULL


Addition.
You can also easily find the equations of these yellow curves by

Eq := diff(y(x), x) = x-y(x); 
Ic := [y(0) = -1, y(1) = -1, y(2) = -1]; 
seq(combine(dsolve({Ic[i], Eq})), i = 1 .. 3);

    

 

Download Differential_Equation_slope_field_new.mw

It works:

with(plottools): with(plots): 
display(seq(seq(display(polygon([[i,j],[i,j+1],[i+1,j+1],[i+1,j]], color=`if`(j::odd,"Magenta", yellow)), textplot([i+.5,j+.5,sprintf("%d",i*j)], font=[times,roman,14])),i=1..10), j=1..10),axes=none);

      

restart;
a:=[3,3,1,5,7,8,5,4,4,4,4,3,9]:
for i from 1 to nops(a) do
if a[i]=4 then a:=subsop(i=NULL,a); break fi;
od;
a;

Or
 

restart;
a:=[3,3,1,5,7,8,5,4,4,4,4,3,9]:
a:=subsop(ListTools:-Search(4,a)=NULL,a);

 

The same bug in Maple 2018.2. Here are 2 workarounds:

restart;
U:= Matrix(4, {seq((i,i)=1,i=1..4), seq(seq((i,j)=u[i,j],j=i+1..4),i=1..3)});
-U;

# Or

U:= Matrix(4, (i,j)->`if`(i=j,1,`if`(j>i,u[i,j],0)));
-U;

 

Here is another approach to solving equations using the  identify  command. Here we first find the roots numerically, and then try to get their symbolic representation. This method is especially useful when solving transcendental equations for which the  solve  command does not work (second example below). These examples works in Maple 2017.3:
 

restart;
Student:-Calculus1:-Roots((x-1)*(x^3-9*x^2+4),numeric);
evalc~(identify(%));
simplify(map2(eval,(x-1)*(x^3-9*x^2+4)=0,x=~%));  # Check

[-.6440222815, .6939575790, 1., 8.950064703]

 

[-3*cos((1/3)*arctan((2/25)*26^(1/2)))+3-3*3^(1/2)*sin((1/3)*arctan((2/25)*26^(1/2))), -3*cos((1/3)*arctan((2/25)*26^(1/2)))+3+3*3^(1/2)*sin((1/3)*arctan((2/25)*26^(1/2))), 1, 6*cos((1/3)*arctan((2/25)*26^(1/2)))+3]

 

[0 = 0, 0 = 0, 0 = 0, 0 = 0]

(1)

Eq:=sin(x)-6*x/Pi/2=0;
solve(Eq, explicit);
allvalues(%);
Student:-Calculus1:-Roots(sin(x)-6*x/Pi/2=0, numeric);
identify(%);
map2(eval,Eq,x=~%);  # Check

sin(x)-3*x/Pi = 0

 

RootOf(-sin(_Z)*Pi+3*_Z)

 

RootOf(-sin(_Z)*Pi+3*_Z, .5235987756), RootOf(-sin(_Z)*Pi+3*_Z, -.5235987756), 0

 

[-.5235987756, 0., .5235987756]

 

[-(1/6)*Pi, 0, (1/6)*Pi]

 

[0 = 0, 0 = 0, 0 = 0]

(2)

 


 

Download identify.mw

 

s:=solve((hv*hw+lv*lw)/(lv+hv)*(lv+hv) = dw*(lv+hv), hv):
expand(``(-numer(s))/``(-denom(s)));

 

To solve this equation it is better to use  the Student:-Calculus1:-Roots  command. In your example, it immediately returns all 4 roots in symbolic form (in Maple 2018.2):

Student:-Calculus1:-Roots((x-1)*(x^3-9*x^2+4), x);
evalf(%);
     
          
                          

I confirm this bug in 2d math input in Maple 2018.2. Here is a workaround:


Here is the simplest way to insert a matrix from the keyboard:

<1, 1; 1, 2/3.4>;
                                              


 

NULL

NULL

restart

NULL

Digits := 20

20

(1)

``

``

NULL

c := .95

.95

(2)

NULL

theta := .9

.9

(3)

k := 1.

1.

(4)

p_l := 10^(-15.)

0.10000000000000000000e-14

(5)

n := 10^10.

10000000000.

(6)

NULL

fsolve(c = p_l^k*(1-p_l)^(n-k)*theta/(p_l^k*(1-p_l)^(n-k)*theta+p^k*(1-p)^n*(1-theta)), p = 1.09*10^(-10) .. .1)

0.14965925863591907056e-8

(7)

NULL

NULL

NULL

``

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL


 

Download test_(4)_new.mw

The functions and the colors should be specified as lists not sets:

w:=x+I*y:
plots[implicitplot]([Im(w) = 2, Re(w) = 2], x = -5 .. 5, y = -5 .. 5, color = ["Blue", "Red"]) ; 


I do not use 2D math input at least because the code typing in it takes more time.

Kollect:=proc(L::set, n::posint)
uses combinat;
`+`(seq(`+`(mul~(choose(L minus {i},n))[])*i^n, i=L));
end proc:

Examples of use:
Kollect({i1, i2, i3, i4}, 2);
Kollect({a, b, c, d, e}, 3);

 

simplify(a, {alpha^2=0});

You can prevent automatic fraction reduction using inert  sqrt :

%sqrt(x)/x;
value(%); 
                                        

 

This is probably due to rounding errors. If you increase  Digits , the plots are identical:

restart;
Digits:=50:
plot(sqrt(Pi/(2*x))*BesselJ(3+1/2, x), x = 0 .. 0.5e-1);
plot(sqrt(Pi/(2*x))*BesselJ(3+.5, x), x = 0 .. 0.5e-1);

 

First 94 95 96 97 98 99 100 Last Page 96 of 290