janhardo

700 Reputation

12 Badges

11 years, 66 days

MaplePrimes Activity


These are replies submitted by janhardo

@janhardo 


 

restart;

B:=Array(1..5,1..2);

Matrix(5, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 0, (4, 1) = 0, (4, 2) = 0, (5, 1) = 0, (5, 2) = 0})

(1)

T2:=Array([[0.5,-1],[1,2],[1.5,1],[1.75,2],[2,2.5]]);

Matrix(5, 2, {(1, 1) = .5, (1, 2) = -1, (2, 1) = 1, (2, 2) = 2, (3, 1) = 1.5, (3, 2) = 1, (4, 1) = 1.75, (4, 2) = 2, (5, 1) = 2, (5, 2) = 2.5})

(2)

op(eval(T2));

1 .. 5, 1 .. 2, {(1, 1) = .5, (1, 2) = -1, (2, 1) = 1, (2, 2) = 2, (3, 1) = 1.5, (3, 2) = 1, (4, 1) = 1.75, (4, 2) = 2, (5, 1) = 2, (5, 2) = 2.5}, datatype = anything, storage = rectangular, order = Fortran_order

(3)

op([2],T2); # go further with this

1 .. 5, 1 .. 2

(4)

Can select all : 1..5 , 1 and 5  ;  1..2 , 1 , 2

op([2,1],T2);

1 .. 5

(5)

op([2,1,1],T2);

1

(6)

op([2,1,2],T2);

5

(7)

op([2,2],T2);

1 .. 2

(8)

op([2,2,1],T2);

1

(9)

op([2,2,2],T2);

2

(10)

 

#op([1],T2); nothing ,[2] is two-dimensional?

op([2],T2);

1 .. 5, 1 .. 2

(11)

 

 

whattype(op([2],T2));

exprseq

(12)

upperbound(T2);

5, 2

(13)

lowerbound(T2);

1, 1

(14)

op([2,1,2], T2) ;

5

(15)

 

op(2, op(1, op(2, T2)));

Error, invalid input: op expects 1 or 2 arguments, but received 3

 

 

 

 


 

Download utzoeken_array_dimensie.mw

 

@Carl Love 

Thanks

The content of the array and the array indexing  are related in this programming of "view" is that it? 
Its a way of modern programming then.

The wireframe ranges for domain must also be made general for any array procedure input

 

@acer 
Thanks

Looking to this explanation ...complicated

Compared with the original bookprogramming is this new programming more advanced , because the intervals for x, y and z  for the 3 axis by a given  input  array are also calculated  by the "view "code in the procedure.

Only how the view code this handles seems to be complicated. 

 

 

 

@acer 

Thanks
I agree with you, to stay in a context for better understanding

@Carl Love 

Thanks

Works great , its the wireframe what's doing the job.
To program this from scratch could be complex to figure out.

Its shows the domain for the planes and compaired with the bookprogramming example, this is so much better.

@janhardo 

It is that the x-axis and y-axis are not visible anymore

 

  restart;
  with(plots):
  T:=Array([[1,2],[1.5,1]]):
  rooster:= plot3d(0,x=0..2, y=0..2,grid=[3,3],color=white):
  display
  ( rooster, [ seq
      ( seq
        ( plot3d
          ( T[i,j],
            x=i-1..i,
            y=j-1..j,
            shading=zhue,
            style=surface,
            axes=normal,
            view=[0..2,0..2,0..2]
          ),
          i=1..2
        ),
        j=1..2
      )
    ]
  );

 

 


 

Download arrplot2domain.mw

@acer 
Thanks

Maybe i can solve this learned by other tasks ?

The domain of a f(x,y) in plot3d is a set of points
Drawing the points with a seq statement..

@tomleslie 

Thanks

Its trivial and straight on for you, but  i need to analyze it compared with the bookexample.

Note:  also for teaching it is not advisable to stress out: how easy or trivial it is for students if they are in their learning process: it can make them unsure. 
Mostly youngster are susceptible for this. (secondairy schools) 
Not everyone can teach.

Your programming looks easier, but its not formulated as a step function. 
Also a domain roster should be informative

In the bookprogramming there is a domain checking, but in this procedure it works differently

 

g:=(x,y)->f(A,B,T,x,y);  with f as procedure

 

h:=(x,y)->doPlot(T);

@tomleslie 

Thanks

Looks good!

Yes, its now indeed a real stepfunction with isolated step area's : what i want.
Also the scaling of the xyz axis is now correct

And no showing domain anymore is now correct and perhaps however adding roster of gridlines to show the domain 
 

No nested do loop and if statements anymore , it looks easier your code,but its not a general procedure yet and making one could be complicated?
 

Note: I try to decipher in the programming book also how the first programming example is set up

@rlopez 

Thanks 

Now i know what's possible. 

@Carl Love 

Thanks

How this statement exactly is build up stays unclear for me.

The piecewise function must for x-values accept : numeric values
Function notation this  must be possible to executed in a plot statement.: plot(h(x) and plot (h) is possible

@Carl Love 

Thanks

Yes, its no problem with the piecewise statement as it works as you mentioned, but the programmingbook likes to program this as exercise
 

@janhardo 

h:= x->`if`( type(x, numeric), 
               piecewise( x<=0,
                          sin(3*x),
                          sin(x/3)
                        ),
              'h(x)'
             ):
Strange maple expression for h  ..thought that i was meant for function definition ( functional oper)ator
Its a if ( condition, function, else...)
Seems that   if   is true then a function in x is created   
 

 

@tomleslie 

Thanks

It was about evaluating rules.

But your programming is a big difference with my example from Maplev5/6 .
To use only expressions in piece-wise functions. 

@acer 

Its not clear how this mechanism works ( R,P)

With this together probably return A[1..n+1,..], P;

(R1,P1):=NewtonM(g,-1,1,1,100,1e-6):

Your note:

note: You don't have to have the procedure return the plot. Given the returned Matrix that was assigned to R4 (for example), you can also get the plot afterwards like this:

Why should i do this ? : i can ask for R4 and P4

First 59 60 61 62 63 64 65 Last Page 61 of 75