janhardo

885 Reputation

12 Badges

11 years, 288 days
B. Ed math

MaplePrimes Activity


These are replies submitted by janhardo

@acer 
Thanks , the cube with ribs do it better.
Note: I wonder what's always wrong with this MaplePrimes website, i could not upload the code ? : has it its own server ?, i think so, because you can run only one url  per server ?

Further the transformation code for the rotation is hidden , so it answering not the initial question.

 

 

 

 

restart;
P := proc(phi)
local Cube, c, V, axes_lines, x_label, y_label, z_label;
uses plots, plottools;

    # Wireframe cube (only lines)
    Cube := cuboid([-1,-1,-1], [1,1,1], style=line, color=black, thickness=2);

    # Draw the coordinate axes ourselves (arrows from -3.5 to 3.5)
    axes_lines :=
        arrow([-3.5,0,0], [3.5,0,0], color=blue, width=0.05, thickness=1),  # x-axis
        arrow([0,-3.5,0], [0,3.5,0], color=blue, width=0.05, thickness=1),  # y-axis
        arrow([0,0,-3.5], [0,0,3.5], color=blue, width=0.05, thickness=1);  # z-axis

    # Labels at the ends of the axes
    x_label := textplot3d([3.7, 0, 0, "x"], font=[Times,bold,20], color=blue);
    y_label := textplot3d([0, 3.7, 0, "y"], font=[Times,bold,20], color=blue);
    z_label := textplot3d([0, 0, 3.7, "z"], font=[Times,bold,20], color=blue);

    # Rotation axis along the x-axis (red arrow)
    c := [-2,0,0], [2,0,0];
    V := arrow([c], color=red, width=0.1, thickness=2);

    # Combine everything and rotate
    display(
        rotate(Cube, phi, [c]),
        axes_lines,
        x_label, y_label, z_label,
        V,
        axes=none,                    # turn off default axes
        scaling=constrained,
        orientation=[40,80],
        view=[-3.7..3.7, -3.7..3.7, -3.7..3.7]
    );
end proc:

plots:-animate(P, [phi], phi=0..2*Pi, frames=90, size=[800,800]);

 

 


 

Download kubus_via_plottottools_met_ribben_DEF_2-4-2026.mw

 




 

@Kitonum 
Which rotation is the cube performing now?

@sand15 

with(Student[LinearAlgebra]):

# Rotation matrix for Euler angles (Z-X-Z) with angles psi, theta, phi
R := RotationMatrix(psi, theta, phi, 'Euler');

Spacefilling curve for a cube with  rotation around x-axis seems to be not possible?

Complex_-real_functions_with_parametersDEF_29-3-2026.mw
for Real and complex functions (x,y,t) and  (x,t) 

The maplet could handle this, but there is for now a max of 10 parameters 

{u(x, y, t) = f__4(y) + f__3(t) - 1/2*f__2(t)*(p + sqrt(p^2 - 4*q*r)*tanh(1/2*sqrt(p^2 - 4*q*r)*f__1(t)))/q}


What do you want to achieve with this programming ?

with(Physics ) ? 

@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);

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