janhardo

982 Reputation

13 Badges

12 years, 66 days
B. Ed math

MaplePrimes Activity


These are answers submitted by janhardo

  The integral outcome

 for 0< a <Pi

restart:
with(codegen):

F := proc(x,y)
    x*y^2
end proc:

G_forward := GRADIENT(F, mode=forward):

G_forward;
                           G_forward


G_forward(2,3);
                             9, 12

 

foo := proc(params)
local b,c,d;

b := rhs(params[1]);
c := rhs(params[2]);
d := rhs(params[3]);

print(b,c,d);

end proc;

foo([b = 2, c = 3, d = 4]);
foo([b = 2, c = 3, d = 4]);
                            2, 3, 4

                            2, 3, 4

Once the procedure has finished, these local variables are no longer in use.
No global assignments were made.

Therefore, the second call is exactly the same as the first:

 

in this format : as fiirst order recurrence equation

 Alfred_F 590
After series option in dsolve  : order= 10 as example 

restart;

infolevel[dsolve] := 5:

ode := (1+f(x))*diff(f(x),x$2)=1+x:
ics := {f(0)=1,D(f)(0)=0}:

T := time():

sol := dsolve(ics union {ode}, f(x));

time()-T;


Does the AI in Maple itself provide better answers than when using AI outside of Maple?

I've been tinkering with the tensor a bit


 

experiment with different conditions for heated rod ( easy experiment, because there can be a lot more involved)   )

heat_pde_procedure_mprimes_16-7-2026.mw

use display command with ; 
The code was otherwise to large for uploading to the mprime server 
 

 

 

 

restart:
with(plots):
with(plottools):

interface(imaginaryunit = J):

printf("\n"):
printf("=============================================================\n"):
printf("      FARADAY-LENZ-LORENTZ: DIDACTIC 3D SIMULATION\n"):
printf("=============================================================\n\n"):

printf("External magnetic field:\n"):
printf("   black arrows point downward: B_ext = -B k\n\n"):

printf("Induced magnetic field:\n"):
printf("   magenta arrows point upward: B_ind = +B_ind k\n\n"):

printf("This shows Lenz's law visually:\n"):
printf("the induced magnetic field opposes the increasing external flux.\n\n"):

printf("Blue rails       = parabolic conducting rails\n"):
printf("Red rod          = moving conducting rod\n"):
printf("Cyan surface     = enclosed flux area\n"):
printf("Black arrows     = external magnetic field downward\n"):
printf("Magenta arrows   = induced counter-field upward\n"):
printf("Yellow arrows    = induced current direction\n"):
printf("Green arrow      = Lorentz force on the rod\n\n"):

printf("=============================================================\n\n"):


# ============================================================
# 1. Parameters
# ============================================================

ParmValues := 0.5, 0.5, 1, 1, 2:

# B    = magnetic field strength
# r    = resistance per unit length
# m    = rod mass
# x__0 = initial position
# v__0 = initial velocity


# ============================================================
# 2. Geometry
# ============================================================

T := x -> (4/3)*x^(3/2):


# ============================================================
# 3. Equation of motion
# ============================================================

ode :=
    m*diff(x(t), t) + B^2*T(x(t))/r
    =
    m*v__0 + B^2*T(x__0)/r:

ics := x(0) = x__0:


# ============================================================
# 4. Numerical solution
# ============================================================

Sol := dsolve(
    {ode, ics},
    numeric,
    parameters = [B, r, m, x__0, v__0]
):

Sol(parameters = [ParmValues]):

B, r, m, x__0, v__0 := ParmValues:


# ============================================================
# 5. Clear external magnetic field arrows
# ============================================================

# Black arrows:
# start high, end low
# direction = downward = -z direction

ExternalBArrow := proc(a, b)
    return arrow(
        [a, b, 1.80],
        [a, b, 0.35],
        0.09,
        0.28,
        0.10,
        color = black
    ):
end proc:

DispExternalB := display(
    seq(
        seq(
            ExternalBArrow(a, b),
            a = 0 .. 5, 0.75
        ),
        b = -3.5 .. 3.5, 0.75
    )
):


# ============================================================
# 6. Clear induced magnetic counter-field arrows
# ============================================================

# Magenta arrows:
# start low, end high
# direction = upward = +z direction
#
# Their height depends on the induced current I.

InducedBArrow := proc(a, b, h)
    return arrow(
        [a, b, 0.05],
        [a, b, 0.05 + h],
        0.08,
        0.25,
        0.09,
        color = magenta
    ):
end proc:


# ============================================================
# 7. Rails
# ============================================================

RailTop := spacecurve(
    [s, sqrt(s), 0],
    s = 0 .. 5,
    color = blue,
    thickness = 6
):

RailBottom := spacecurve(
    [s, -sqrt(s), 0],
    s = 0 .. 5,
    color = blue,
    thickness = 6
):

DispWire := display([RailTop, RailBottom]):


# ============================================================
# 8. Animation loop
# ============================================================

i := 0:

for tau from 0 by 0.025 to 4 do

    vals := Sol(tau):

    X := rhs(vals[2]):

    V :=
        (
            m*v__0
            + B^2*T(x__0)/r
            - B^2*T(X)/r
        )/m:

    L := 2*sqrt(X):

    DiffT := L*V:

    Flux := B*T(X):

    EMF := B*DiffT:

    R := r*L:

    I := EMF/R:

    LorentzForce := I*B*L:

    Accel := -LorentzForce/m:

    JoulePower := I^2*R:

    InducedHeight := min(1.25, 0.35 + 0.70*abs(I)):

    Rod := spacecurve(
        [X, u, 0],
        u = -sqrt(X) .. sqrt(X),
        color = red,
        thickness = 9
    ):

    AreaPatch := plot3d(
        [s, q*sqrt(s), 0],
        s = 0 .. X,
        q = -1 .. 1,
        color = cyan,
        transparency = 0.65
    ):

    # Induced field only inside the enclosed loop
    DispInducedB := display(
        seq(
            seq(
                InducedBArrow(s, q*sqrt(s), InducedHeight),
                s = 0.30 .. X, 0.65
            ),
            q = -0.70 .. 0.70, 0.35
        )
    ):

    # Current direction:
    # for external B downward and increasing flux,
    # induced current is counterclockwise when viewed from +z.

    CurrentBottom := arrow(
        [0.20*X, -sqrt(0.20*X), 0.18],
        [0.60*X, -sqrt(0.60*X), 0.18],
        0.09,
        0.28,
        0.10,
        color = yellow
    ):

    CurrentRod := arrow(
        [X, -0.65*sqrt(X), 0.18],
        [X,  0.65*sqrt(X), 0.18],
        0.09,
        0.28,
        0.10,
        color = yellow
    ):

    CurrentTop := arrow(
        [0.85*X, sqrt(0.85*X), 0.18],
        [0.45*X, sqrt(0.45*X), 0.18],
        0.09,
        0.28,
        0.10,
        color = yellow
    ):

    DispCurrent := display(
        [CurrentBottom, CurrentRod, CurrentTop]
    ):

    # Lorentz force opposes motion, therefore points left
    ForceArrow := arrow(
        [X, 0, 0.55],
        [X - min(1.20, 0.35 + 0.35*abs(LorentzForce)), 0, 0.55],
        0.10,
        0.30,
        0.11,
        color = green
    ):

    i := i + 1:

    Disp[i] := display(
        [
            DispExternalB,
            DispInducedB,
            DispWire,
            AreaPatch,
            Rod,
            DispCurrent,
            ForceArrow
        ],
        axes = normal,
        labels = ["x", "y", "z"],
        scaling = constrained,
        orientation = [60, 68],
        view = [0 .. 5, -3.8 .. 3.8, -0.2 .. 2.0],
        size = [1100, 850],
        caption = typeset(
            "BLACK: B_ext downward  |  MAGENTA: B_ind upward  |  t=%1, x=%2, v=%3, EMF=%4, I=%5, F_L=%6",
            evalf(tau, 3),
            evalf(X, 4),
            evalf(V, 4),
            evalf(EMF, 4),
            evalf(I, 4),
            evalf(LorentzForce, 4)
        ),
        captionfont = [Courier, bold, 14]
    ):

end do:


# ============================================================
# 9. Display larger animation
# ============================================================

display(
    seq(Disp[j], j = 1 .. i),
    insequence,
    axes = normal,
    labels = ["x", "y", "z"],
    scaling = constrained,
    orientation = [60, 68],
    size = [1100, 850],
    title = typeset(
        "Lenz's law: induced magenta field points opposite to increasing external black flux"
    ),
    titlefont = [Courier, bold, 16]
):


=============================================================
      FARADAY-LENZ-LORENTZ: DIDACTIC 3D SIMULATION
=============================================================

External magnetic field:
   black arrows point downward: B_ext = -B k

Induced magnetic field:
   magenta arrows point upward: B_ind = +B_ind k

This shows Lenz's law visually:
the induced magnetic field opposes the increasing external flux.

Blue rails       = parabolic conducting rails
Red rod          = moving conducting rod
Cyan surface     = enclosed flux area
Black arrows     = external magnetic field downward
Magenta arrows   = induced counter-field upward
Yellow arrows    = induced current direction
Green arrow      = Lorentz force on the rod

=============================================================

 

 

 

Download conducting_rod_in_magnetisch_veld_mprimesVersie_A_8-7-2026.mw

@KIRAN SAJJAN 
no shooting method is used

 

In een document geopend : Ctrl+ J  geeft de prompt voor de 1D mode
(1D mode in werkblad is dit alleen tekst). In  2D mode(document) is dat via een pallete invoer.

@Alfred_F 

Green's claim turns out to be untenable: simply answering that question is both sufficient and interesting in itself.
What, then, remains for a solution strategy?

The double integral can be rewritten as a single integral...

restart:

interface(prettyprint=2):
Digits := 50:

printf("====================================================\n"):
printf("DISCOVERY OF THE SOLUTION\n"):
printf("====================================================\n\n"):

#----------------------------------------------------
# THE PROBLEM
#----------------------------------------------------

Problem :=
Int(
 Int(
   (2*x^2+1)/(x^4+6*x^2*y^2+y^4+1)
   -(y^2+1)/(x^4+y^4+2),
   x=-sqrt(R^2-y^2)..sqrt(R^2-y^2)
 ),
 y=-R..R
);

printf("Original problem:\n\n"):

Problem;

#====================================================
# INVESTIGATION 1
# CAN GREEN'S THEOREM HELP?
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 1 : GREEN'S THEOREM\n"):
printf("====================================================\n\n"):

DenGreen :=
x^4+6*x^2*y^2+y^4+1;

DenGreen;

printf("\nTry to rewrite the denominator:\n\n"):

expand((x^2-y^2)^2+(2*x*y+1)^2);

uG := x^2-y^2:
vG := 2*x*y+1:

uG^2+vG^2;

printf("\nObservation:\n\n"):

printf("The denominator is u^2+v^2.\n"):
printf("This suggests log(u+iv) or arg(u+iv).\n"):
printf("Therefore Green's theorem looks promising.\n\n"):

printf("We would need:\n\n"):

printf("      dQ/dx - dP/dy = integrand\n\n"):

printf("After several attempts no simple vector field\n"):
printf("P,Q was found.\n\n"):

printf("Therefore we try another idea.\n\n");

#====================================================
# INVESTIGATION 2
# THE DOMAIN
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 2 : THE DOMAIN\n"):
printf("====================================================\n\n"):

Disk :=
x^2+y^2 <= R^2;

Disk;

printf("\nThe domain is a disk.\n"):
printf("Therefore polar coordinates are natural.\n\n");

xp := r*cos(theta):
yp := r*sin(theta):

x = xp;

y = yp;

dx*dy = r*dr*dtheta;

#====================================================
# INVESTIGATION 3
# WHAT HAPPENS TO THE DENOMINATORS?
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 3 : THE DENOMINATORS\n"):
printf("====================================================\n\n"):

Den1 :=
expand(
 xp^4
 +6*xp^2*yp^2
 +yp^4
 +1
);

Den2 :=
expand(
 xp^4
 +yp^4
 +2
);

Den1;

Den2;

printf("\nCollect trigonometric terms:\n\n"):

TrigRule :=
sin(2*theta)^2 =
(1-cos(4*theta))/2;

TrigRule;

Den1Polar :=
simplify(
 subs(
  TrigRule,
  1+r^4*(1+sin(2*theta)^2)
 )
);

Den2Polar :=
simplify(
 subs(
  TrigRule,
  2+r^4*(1-sin(2*theta)^2/2)
 )
);

Den1Polar;

Den2Polar;

printf("\nImportant observation:\n\n"):

printf("Both denominators contain only cos(4 theta).\n\n");

#====================================================
# INVESTIGATION 4
# THE NUMERATORS
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 4 : THE NUMERATORS\n"):
printf("====================================================\n\n"):

CosRule :=
cos(theta)^2 =
(1+cos(2*theta))/2;

SinRule :=
sin(theta)^2 =
(1-cos(2*theta))/2;

CosRule;

SinRule;

Num1 :=
expand(
2*r^2*cos(theta)^2+1
);

Num2 :=
expand(
r^2*sin(theta)^2+1
);

Num1;

Num2;

printf("\nObservation:\n\n"):

printf("The numerators contain cos(2 theta).\n"):
printf("The denominators contain cos(4 theta).\n\n");

#====================================================
# INVESTIGATION 5
# WHY DOES COS(2 THETA) DISAPPEAR?
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 5 : FOURIER ORTHOGONALITY\n"):
printf("====================================================\n\n"):

TestFunction :=
cos(2*theta)/(a+b*cos(4*theta));

TestFunction;

SymmetryCheck :=
simplify(
 subs(theta=theta+Pi/2,TestFunction),
 trig
);

SymmetryCheck;

printf("\nThe function changes sign under\n"):
printf("theta -> theta + Pi/2.\n\n"):

Orthogonality :=
Int(
 cos(2*theta)/(a+b*cos(4*theta)),
 theta=0..2*Pi
)=0;

Orthogonality;

printf("\nTherefore all cos(2 theta) terms vanish.\n\n");

#====================================================
# INVESTIGATION 6
# ANGULAR INTEGRATION
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 6 : THETA INTEGRATION\n"):
printf("====================================================\n\n"):

a1 := 1+3*r^4/2:
b1 := -r^4/2:

a2 := 2+3*r^4/4:
b2 := r^4/4:

Formula :=
Int(
 1/(a+b*cos(4*theta)),
 theta=0..2*Pi
)
=
2*Pi/sqrt(a^2-b^2);

Formula;

A1 :=
simplify(
(r^2+1)
*2*Pi/sqrt(a1^2-b1^2)
);

A2 :=
simplify(
(1+r^2/2)
*2*Pi/sqrt(a2^2-b2^2)
);

A1;

A2;

factor(a1^2-b1^2);

factor(a2^2-b2^2);

#====================================================
# INVESTIGATION 7
# THE DOUBLE INTEGRAL COLLAPSES
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 7 : RADIAL INTEGRAL\n"):
printf("====================================================\n\n"):

RadialIntegral :=
Int(
r*(A1-A2),
r=0..infinity
);

RadialIntegral;

#====================================================
# INVESTIGATION 8
# FINAL SUBSTITUTION
#====================================================

printf("\n====================================================\n"):
printf("INVESTIGATION 8 : u = r^2\n"):
printf("====================================================\n\n"):

u = r^2;

r*dr = du/2;

f :=
(u+1)/sqrt((1+u^2)*(1+2*u^2))
-
sqrt(2)*(u/2+1)
/
sqrt((u^2+2)*(u^2+4));

f;

FinalIntegral :=
Pi*
Int(
f,
u=0..infinity
);

FinalIntegral;

#====================================================
# NUMERICAL EVALUATION
#====================================================

printf("\n====================================================\n"):
printf("NUMERICAL EVALUATION\n"):
printf("====================================================\n\n"):

Value :=
evalf(FinalIntegral,50);

Value;

#====================================================
# IDENTIFICATION
#====================================================

printf("\nMaple identifies:\n\n"):

ExactValue :=
identify(Value);

ExactValue;

#====================================================
# FINAL CONCLUSION
#====================================================

Result :=
Pi*ln(2)/sqrt(2);

Result;

====================================================
DISCOVERY OF THE SOLUTION
====================================================
 

 

Int(Int((2*x^2+1)/(x^4+6*x^2*y^2+y^4+1)-(y^2+1)/(x^4+y^4+2), x = -(R^2-y^2)^(1/2) .. (R^2-y^2)^(1/2)), y = -R .. R)

 

Original problem:
 

 

Int(Int((2*x^2+1)/(x^4+6*x^2*y^2+y^4+1)-(y^2+1)/(x^4+y^4+2), x = -(R^2-y^2)^(1/2) .. (R^2-y^2)^(1/2)), y = -R .. R)

 


====================================================
INVESTIGATION 1 : GREEN'S THEOREM
====================================================
 

 

x^4+6*x^2*y^2+y^4+1

 

x^4+6*x^2*y^2+y^4+1

 


Try to rewrite the denominator:
 

 

x^4+2*x^2*y^2+y^4+4*x*y+1

 

(x^2-y^2)^2+(2*x*y+1)^2

 


Observation:

The denominator is u^2+v^2.
This suggests log(u+iv) or arg(u+iv).
Therefore Green's theorem looks promising.

We would need:

      dQ/dx - dP/dy = integrand

After several attempts no simple vector field
P,Q was found.

Therefore we try another idea.


====================================================
INVESTIGATION 2 : THE DOMAIN
====================================================
 

 

x^2+y^2 <= R^2

 

x^2+y^2 <= R^2

 


The domain is a disk.
Therefore polar coordinates are natural.
 

 

x = r*cos(theta)

 

y = r*sin(theta)

 

dx*dy = r*dr*dtheta

 


====================================================
INVESTIGATION 3 : THE DENOMINATORS
====================================================
 

 

r^4*cos(theta)^4+6*r^4*cos(theta)^2*sin(theta)^2+r^4*sin(theta)^4+1

 

r^4*cos(theta)^4+r^4*sin(theta)^4+2

 

r^4*cos(theta)^4+6*r^4*cos(theta)^2*sin(theta)^2+r^4*sin(theta)^4+1

 

r^4*cos(theta)^4+r^4*sin(theta)^4+2

 


Collect trigonometric terms:
 

 

sin(2*theta)^2 = 1/2-(1/2)*cos(4*theta)

 

sin(2*theta)^2 = 1/2-(1/2)*cos(4*theta)

 

1-(1/2)*r^4*(-3+cos(4*theta))

 

2+(1/4)*r^4*(3+cos(4*theta))

 

1-(1/2)*r^4*(-3+cos(4*theta))

 

2+(1/4)*r^4*(3+cos(4*theta))

 


Important observation:

Both denominators contain only cos(4 theta).


====================================================
INVESTIGATION 4 : THE NUMERATORS
====================================================
 

 

cos(theta)^2 = 1/2+(1/2)*cos(2*theta)

 

sin(theta)^2 = 1/2-(1/2)*cos(2*theta)

 

cos(theta)^2 = 1/2+(1/2)*cos(2*theta)

 

sin(theta)^2 = 1/2-(1/2)*cos(2*theta)

 

2*r^2*cos(theta)^2+1

 

r^2*sin(theta)^2+1

 

2*r^2*cos(theta)^2+1

 

r^2*sin(theta)^2+1

 


Observation:

The numerators contain cos(2 theta).
The denominators contain cos(4 theta).


====================================================
INVESTIGATION 5 : FOURIER ORTHOGONALITY
====================================================
 

 

cos(2*theta)/(a+b*cos(4*theta))

 

cos(2*theta)/(a+b*cos(4*theta))

 

-cos(2*theta)/(2*b*cos(2*theta)^2+a-b)

 

-cos(2*theta)/(2*b*cos(2*theta)^2+a-b)

 


The function changes sign under
theta -> theta + Pi/2.
 

 

Int(cos(2*theta)/(a+b*cos(4*theta)), theta = 0 .. 2*Pi) = 0

 

Int(cos(2*theta)/(a+b*cos(4*theta)), theta = 0 .. 2*Pi) = 0

 


Therefore all cos(2 theta) terms vanish.


====================================================
INVESTIGATION 6 : THETA INTEGRATION
====================================================
 

 

Int(1/(a+b*cos(4*theta)), theta = 0 .. 2*Pi) = 2*Pi/(a^2-b^2)^(1/2)

 

Int(1/(a+b*cos(4*theta)), theta = 0 .. 2*Pi) = 2*Pi/(a^2-b^2)^(1/2)

 

2*(r^2+1)*Pi/(2*r^8+3*r^4+1)^(1/2)

 

2*(r^2+2)*Pi/(2*r^8+12*r^4+16)^(1/2)

 

2*(r^2+1)*Pi/(2*r^8+3*r^4+1)^(1/2)

 

2*(r^2+2)*Pi/(2*r^8+12*r^4+16)^(1/2)

 

(2*r^4+1)*(r^4+1)

 

(1/2)*(r^2+2*r+2)*(r^2-2*r+2)*(r^4+2)

 


====================================================
INVESTIGATION 7 : RADIAL INTEGRAL
====================================================
 

 

Int(r*(2*(r^2+1)*Pi/(2*r^8+3*r^4+1)^(1/2)-2*(r^2+2)*Pi/(2*r^8+12*r^4+16)^(1/2)), r = 0 .. infinity)

 

Int(r*(2*(r^2+1)*Pi/(2*r^8+3*r^4+1)^(1/2)-2*(r^2+2)*Pi/(2*r^8+12*r^4+16)^(1/2)), r = 0 .. infinity)

 


====================================================
INVESTIGATION 8 : u = r^2
====================================================
 

 

u = r^2

 

r*dr = (1/2)*du

 

(u+1)/((u^2+1)*(2*u^2+1))^(1/2)-2^(1/2)*((1/2)*u+1)/((u^2+2)*(u^2+4))^(1/2)

 

(u+1)/((u^2+1)*(2*u^2+1))^(1/2)-2^(1/2)*((1/2)*u+1)/((u^2+2)*(u^2+4))^(1/2)

 

Pi*(Int((u+1)/((u^2+1)*(2*u^2+1))^(1/2)-2^(1/2)*((1/2)*u+1)/((u^2+2)*(u^2+4))^(1/2), u = 0 .. infinity))

 

Pi*(Int((u+1)/((u^2+1)*(2*u^2+1))^(1/2)-2^(1/2)*((1/2)*u+1)/((u^2+2)*(u^2+4))^(1/2), u = 0 .. infinity))

 


====================================================
NUMERICAL EVALUATION
====================================================
 

 

1.5397858910711787095189345381374037575145483425360

 

1.5397858910711787095189345381374037575145483425360

 


Maple identifies:
 

 

(1/2)*2^(1/2)*Pi*ln(2)

 

(1/2)*2^(1/2)*Pi*ln(2)

 

(1/2)*2^(1/2)*Pi*ln(2)

 

(1/2)*2^(1/2)*Pi*ln(2)

(1)

evalf(sqrt(2)*Pi*ln(2)/2);

1.5397858910711787095189345381374037575145483425359

(2)
 

 

Download QuestionMP_Calculation_of_the_integral_and_Greens_integral_theorem_21-6-2026.mw

 

F := e -> applyrule(Int(Sum(f::anything, s::anything), r::{name, name=range}) = Sum(Int(f, r), s), e);

expr1 := Int(Sum(n^2, n=1..5), x=0..1);
F(expr1);

expr2 := Int(Sum(x^k, k=0..3), x);
F(expr2);

option : show_navy_triangles := false;
Spirale_Suites_complexe_animatie_gemaaktDEF_2-5-2026.mw

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