Axel Vogt

5936 Reputation

20 Badges

20 years, 246 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are answers submitted by Axel Vogt


 

# https://www.mapleprimes.com/questions/239610-Error-in--Integer-Overflow-Detected
restart: kernelopts(version);

`Maple 2024.1, X86 64 WINDOWS, Jun 25 2024, Build ID 1835466`

(1)


Once I bookmarked https://www.maplesoft.com/applications/detail.aspx?id=5837
and after a small modification the authors' solution can be compiled.

J:=proc(n::integer)
local m, s, i, p, j, f, k;
m := n*n;
s := 1;
for i to m do
    p := 0;
    for j to i do
        f := 1;
        for k to j-1 do
            f := f*k*k;
            f := f mod j
        end do;
        p := p+f
    end do;
    s := s+max(0,1-max(0,p-n))
end do;
s
end proc;

proc (n::integer) local m, s, i, p, j, f, k; m := n*n; s := 1; for i to m do p := 0; for j to i do f := 1; for k to j-1 do f := f*k*k; f := `mod`(f, j) end do; p := p+f end do; s := s+max(0, 1-max(0, p-n)) end do; s end proc

(2)

cJ:=Compiler:-Compile(J):

J(4);
cJ(4);

7

(3)

cJ(30);

113

(4)

 


 

Download MP_239610_Jones_Algorithm.mw

How about using normal(e) ? Or simplify(e) ?

There is a page for downloading as well. For that I use a chromium based browser (instead of Firefox), https://en.wikipedia.org/wiki/Ungoogled-chromium, there exists a portable version for it.

Please write corrections into your original thread instead of opening a new one.

Otherwise it will become quite confusing.

Using the valid (!) transformation arcsinh(2*x) = y, i.e. x = sinh(y)/2, 0 <= y gives it after 'simplify'.

If you insert x[2] from g into f then you find x[1] = - 0.668... now feeding g you find x[1] = - 1.552 ...

For me the keyboard combination <ctrl> + <D> works.

I think it can be written as a* sqrt( cos(x+c__1)^2 ) which I consider to be more simple (even if LeafCount is the same as for e2)

MP_238462_some_simplification.mw

You may try the following approach:

fsolve usually delivers real solutions only. If you want positive ones you can change your variable, say x, to X^2, fsolve for X and square it.

Find an example bellow. However I will not do it for your problem.

# https://www.mapleprimes.com/questions/238400-Helping-Fsolve

eq:=(x-1)^2-16;   # plot(%);
{fsolve(eq)};     # set of solutions = {-3, +5}

eq := (x-1)^2-16

{-3.00000000000000, 5.00000000000000}

(1)

EQ:=eval(eq, x=X^2);
# {fsolve(EQ, complex)};     # set of complex solutions for EQ
{fsolve(EQ)};                # set of (real) solutions for EQ
map(q -> q^2, %);            # now back to eq

EQ := (X^2-1)^2-16

{-2.23606797749979, 2.23606797749979}

{5.00000000000000}

(2)

 


 

Download MP_238400_positive_solutions.mws

You can use

(*

  (some code to be de-activated)

*)

For example

 

restart; interface(version);

`Classic Worksheet Interface, Maple 2017.3, Windows, Sep 27 2017, Build ID 1265877`

(1)

 

f:= z -> 1/(z + 2);
f(x+I*y);
u:=unapply(evalc(Re(%)), x,y);
v:=unapply(evalc(Im(%%)), x,y);

f := proc (z) options operator, arrow; 1/(z+2) end proc

1/(x+y*I+2)

u := proc (x, y) options operator, arrow; (x+2)/((x+2)^2+y^2) end proc

v := proc (x, y) options operator, arrow; -y/((x+2)^2+y^2) end proc

(2)

 

['D[1](u)(x,y) = D[2](v)(x,y)', 'D[2](u)(x,y) = -D[1](v)(x,y)'];
simplify(%): evalc(%);
map(is, %);

[(D[1](u))(x, y) = (D[2](v))(x, y), (D[2](u))(x, y) = -(D[1](v))(x, y)]

[(-x^2+y^2-4*x-4)/(x^2+y^2+4*x+4)^2 = (-x^2+y^2-4*x-4)/(x^2+y^2+4*x+4)^2, (-2*x-4)*y/(x^2+y^2+4*x+4)^2 = (-2*x-4)*y/(x^2+y^2+4*x+4)^2]

[true, true]

(3)

'[diff(u(x,y),x) = diff(v(x,y),y), diff(u(x,y),y) = -diff(v(x,y),x)]';
evalc(%): simplify(%);
map(is, %);

[diff(u(x, y), x) = diff(v(x, y), y), diff(u(x, y), y) = -(diff(v(x, y), x))]

[(-x^2+y^2-4*x-4)/(x^2+y^2+4*x+4)^2 = (-x^2+y^2-4*x-4)/(x^2+y^2+4*x+4)^2, -2*(x+2)*y/(x^2+y^2+4*x+4)^2 = -2*(x+2)*y/(x^2+y^2+4*x+4)^2]

[true, true]

(4)
   
 

 


 

Download CR.mws

It should simplify to - 2/7
 

# https://www.mapleprimes.com/questions/236590-Error-in-Trignormalsincosargs-Too
restart; kernelopts(version);

`Maple 2024.0, X86 64 WINDOWS, Feb 05 2024, Build ID 1785419`

(1)

expr := -1/7 - (-1/7*7^(5/7)*exp(2/7*Pi*I)*sin(1/7*Pi)*I - 1/7*cos(1/7*Pi)*7^(5/7)*exp(2/7*Pi*I))^(7/2):

# evalf[20](expr): fnormal(%): identify(%); # = -2/7

# evalc(expr): simplify(%);                 # = -2/7

simplify(expr):
evalc(%): simplify(%);                      # = -2/7

-2/7

(2)

# convert(expr, trig): simplify(%);         # = -2/7


 

Download MP_236590.mw

It often helps to care for spurious numerical imaginary results:

[Re(res), Im(res)]:
plot(%,t=-5..1, color=[red,blue]);

For example like this (upload does not work ...):

NumericEventHandler(invalid_operation = `Heaviside/EventHandler`(value_at_zero = 0)):
assume(u::real, v::real);

[Int(Dirac(u-v), [u, v]) , min(u,v)]; value(%);
convert(%, piecewise, u);
%[1] - %[2]; # = 0

[Int(Dirac(u+v-1), [u, v]), max(u+v-1, 0)]; value(%);
convert(%, piecewise, u);
%[1] - %[2]; # = 0

 

 

I think that limit(expr, +oo) = 24 is false

1 2 3 4 5 6 7 Last Page 1 of 93