janhardo

870 Reputation

12 Badges

11 years, 267 days
B. Ed math

MaplePrimes Activity


These are replies submitted by janhardo

@salim-barzani 
It's a start; the next step is to adapt the maplet for functions  with parameters 

Maplet coding is much more difficult then explore plot coding , but  maplet coding offers more configurations for  a  GUI design.

 

Download 3_functies_tegelijk_plotten_maplet-DEF.mw

@jalal

You must first determine which educational situation applies for two skew lines in space, their orientation:

  • intersecting lines

  • parallel lines

  • skew lines

@nm 
Unfortunately, I can't help you any further, because I don't have enough experience with it.

Strangely enough, you chose a maplet without sliders as the best answer?
Indeed, the parameters for this are much clearer, but this can also be done for the maplet with sliders.
The maplet with sliders is much easier to use for research, in my opinion.


Mapleprimes is blocking this maplet code ?, so you can download it. 
It could be exercise to do this with the maplet editor, but seems to me a challence to start with.

https://www.dropbox.com/scl/fi/8q8zgmdonxqgij8mtas9v/lotka-volterra-slider-Def-mprimes.mw?rlkey=vt84fwl619dt4fe816gren8yq&st=qj9v2zkf&dl=0

final version Lotka Volterra with linked plots : note : access denied for uploading now ?
note: I am surprised by the ai quality in helping me with this maplet, as I had not had a good experience with it before.
There is a user-unfriendly maplet editor what you can use to build maplets.

What are the equilibrium points in the phase plot ( if existing) ?

@dharr There are multiple ways in Maple to solve mathematical problems. Well, I think it's quite an achievement to develop these procedural paths by you , compared to the code I produced.

@dharr 

That's a substantial procedure called paths.
Indeed, 510 paths, and the algorithm created seems shorter and uses a different calculation method.
Just for fun, I created an animation that shows all the paths.
There is no control mechanism code to check whether the number of paths is correct, but that is possible.
I take no credit whatsoever for this code,

restart:
with(plots):

interface(warnlevel=0):

# =====================================
# ROOSTER
# =====================================

W := 11:
H := 3:

start := [2,2]:
finish := [10,2]:

visited := Array(1..W,1..H,fill=false):

count := 0:

# =====================================
# ROOSTER TEKENEN
# =====================================

gridlines := []:

for i from 1 to W+1 do
    gridlines := [op(gridlines),
        plot([[i,1],[i,H+1]],color=gray)]:
od:

for j from 1 to H+1 do
    gridlines := [op(gridlines),
        plot([[1,j],[W+1,j]],color=gray)]:
od:

grid := display(gridlines):

# =====================================
# BEGIN- EN EINDPUNT MARKERING
# =====================================

startplot := pointplot(
    [[start[1]+0.5,start[2]+0.5]],
    symbol=solidcircle,
    symbolsize=20,
    color=green):

finishplot := pointplot(
    [[finish[1]+0.5,finish[2]+0.5]],
    symbol=solidcircle,
    symbolsize=20,
    color=red):

# =====================================
# BUURFUNCTIE
# =====================================

neighbors := proc(x,y)
local L,d,nx,ny;

L := [];

for d in [[1,0],[-1,0],[0,1],[0,-1]] do
    nx := x+d[1]:
    ny := y+d[2]:

    if nx>=1 and nx<=W and ny>=1 and ny<=H then
        L := [op(L),[nx,ny]]:
    fi:
od:

return L:

end proc:

# =====================================
# FRAMES OPSLAG
# =====================================

frames := []:

add_frame := proc(path)

global frames,count,grid,startplot,finishplot;

local pts,p1,p2,label,i,frame;

pts := [seq([path[i][1]+0.5,path[i][2]+0.5], i=1..nops(path))];

p1 := pointplot(
    pts,
    symbol=solidcircle,
    symbolsize=12,
    color=blue):

p2 := plot(
    pts,
    thickness=4,
    color=red):

label := textplot(
    [6,4,cat("Aantal gevonden paden = ",count)]
):

frame := display(
    [grid,p1,p2,startplot,finishplot,label],
    axes=none,
    scaling=constrained,
    view=[1..W+1,1..H+1]
):

frames := [op(frames), frame]:

end proc:

# =====================================
# DFS
# =====================================

DFS := proc(x,y,path,steps)

global visited,count,W,H,finish;

local nb,nx,ny;

if [x,y]=finish and steps=W*H then

    count := count+1:

    add_frame(path):

    return:

fi:

for nb in neighbors(x,y) do

    nx := nb[1]:
    ny := nb[2]:

    if not visited[nx,ny] then

        visited[nx,ny] := true:

        DFS(nx,ny,[op(path),[nx,ny]],steps+1):

        visited[nx,ny] := false:

    fi:

od:

end proc:

# =====================================
# START
# =====================================

visited[start[1],start[2]] := true:

DFS(start[1],start[2],[start],1):

# =====================================
# ANIMATIE
# =====================================

display(frames,insequence=true);

@KIRAN SAJJAN 
Can't make it more from it now
fig_8a_vraagmprimes_25-2-2026.mw

@Kitonum , Thank you, it's now clear what it's about.

@Kitonum 
How do you call this graph ?
Its not a Hamilton graph.

There is a Physics and DifferentialGeometry package and it seems that you can do this in both  packages 

Apparently, it works via a different type of derivative.
The differential geometry in Maple has a geometric object calculation from which components can be derived
In addition, the usual standard calculation method in Maple
I am trying to familiarize myself with the package.

 

 

 

restart:

with(DifferentialGeometry):
with(Tensor):
with(Tools):

#========================================================
# (1) Definieer de 2-sfeer S^2
#========================================================

DGsetup([theta, phi], S2):

g := evalDG( dtheta &t dtheta
           + sin(theta)^2 * dphi &t dphi ):

print("---- (1) METRIEK g ----"):

DGinfo(g, "ObjectType");
DGinfo(g, "ObjectComponents");
convert(g, DGArray);

#========================================================
# (2) Inverse metriek
#========================================================

ginv := InverseMetric(g):

print("---- (2) INVERSE METRIEK ----"):

DGinfo(ginv, "ObjectType");
DGinfo(ginv, "ObjectComponents");
convert(ginv, DGArray);

#========================================================
# (3) Directional derivative van scalar
#========================================================

X := D_theta + 2*D_phi:
f := cos(theta):

 Xf := DirectionalDerivative(X, f):

print("---- (3) DIRECTIONAL DERIVATIVE ----"):

#whattype(Xf);     # toont dat dit gewoon een scalar is
# DGinfo(Xf, "ObjectComponents");  # <-- zou fout geven!

#########  om een waarde te krijgen  JD ####
# Optioneel: met LieDerivative
Xf_lie := LieDerivative(X, f);
simplify(Xf_lie);

#========================================================
# (4) Christoffel-symbolen
#========================================================

Gamma := Christoffel(g):

print("---- (4) CHRISTOFFEL ----"):

DGinfo(Gamma, "ObjectType");
DGinfo(Gamma, "ObjectComponents");

# convert(Gamma, DGArray);  # <-- geeft fout (geen tensor!)

#========================================================
# (5) Riemann tensor
#========================================================

R := CurvatureTensor(g):

print("---- (5) RIEMANN TENSOR ----"):

DGinfo(R, "ObjectType");
DGinfo(R, "ObjectComponents");

#========================================================
# (6) Ricci tensor
#========================================================

Ric := RicciTensor(R):

print("---- (6) RICCI TENSOR ----"):

DGinfo(Ric, "ObjectType");
DGinfo(Ric, "ObjectComponents");
convert(Ric, DGArray);


#========================================================
# (7) Ricci scalar
#========================================================

Rscalar := RicciScalar(g):

print("---- (7) RICCI SCALAR ----"):

whattype(Rscalar);   # scalar, geen tensor

#========================================================
# (8) Gausskromming
#========================================================

detg := MetricDensity(g, 2):

K := simplify(
      DGinfo(R, "CoefficientList", [[1,2,1,2]])[1]
      / detg ):

print("---- (8) GAUSSKROMMING ----"):

K;

"---- (1) METRIEK g ----"

 

"tensor"

 

[[[1, 1], 1], [[2, 2], sin(theta)^2]]

 

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = sin(theta)^2})

 

"---- (2) INVERSE METRIEK ----"

 

"tensor"

 

[[[1, 1], 1], [[2, 2], 1/sin(theta)^2]]

 

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1/sin(theta)^2})

 

"---- (3) DIRECTIONAL DERIVATIVE ----"

 

Xf_lie := -sin(theta)

 

-sin(theta)

 

"---- (4) CHRISTOFFEL ----"

 

"connection"

 

[[[1, 2, 2], -(1/2)*sin(2*theta)], [[2, 1, 2], cot(theta)], [[2, 2, 1], cot(theta)]]

 

"---- (5) RIEMANN TENSOR ----"

 

"tensor"

 

[[[1, 2, 1, 2], sin(theta)^2], [[1, 2, 2, 1], -sin(theta)^2], [[2, 1, 1, 2], -1], [[2, 1, 2, 1], 1]]

 

"---- (6) RICCI TENSOR ----"

 

"tensor"

 

[[[1, 1], 1], [[2, 2], sin(theta)^2]]

 

Array(%id = 36893490623282316820)

 

"---- (7) RICCI SCALAR ----"

 

integer

 

"---- (8) GAUSSKROMMING ----"

 

sin(theta)^2/_DG([["tensor", S2, [[], [["bas", 2]]]], [[[], sin(theta)^2]]])

(1.1)
 

 

Download directionl_derative_word_lie_derative_nog_niet_berekend_16-2-2026.mw

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