janhardo

910 Reputation

13 Badges

11 years, 312 days
B. Ed math

MaplePrimes Activity


These are replies submitted by janhardo

@Carl Love 

Thanks

This is a procedure you made, but that's not needed in this task ( even before the procedure is introduced in the book )
Its too difficult for me now in the learning process to understand the procedure.

.
I enclosed the worksheet where i am struggling to try to getting to draw the magenta lines for the Riemann rightsum rule

Above is the Riemann lefthand rule drawed with the tread-riser outline 

Note: the tread-riser  is made out of 3 points connected with linesegments
There is no +1:  y -value possible yet in the code what i needed to get a point for the tread riser step 

The undersum (rectangle under graph) starts at X0 and the uppersum(rectangle above graph)  by X1 for calculating the sum.  

There are 3 plots : a vertical line at a and a vertical line at b and the tread riser step    


 

restart;with(plots):

 task 1 (a)

 

N:=10: # code op blz 47 parabool (x^2+1)

dX:=(b-a)/N: #

X:=a: Y:=f(X): s:=0:

for i from 1 to N do

   s:= s+Y*dX; # geen i,is f(x).dx gesommeerd

   X:= X+dX; Y:=f(X); #geen i

end do:

 

 

Wat doe de code hierboven ? : de loop telt  y.dx  (f(x).dx)  op  in een som s
s= s+ y0.dx = y0.dx
s = s+y1.dx = y0dx + y1.dx

s=  .........

s= s+ yN-1.dx = y0.dx+y1.dx+ ....+yN-1.dx (alg )

 

task 1(b)Via Array

X:=Array(0..N); Y:=Array(0..N);

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

 

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

(1)

dX:=(b-a)/N:

X[0]:=a: Y[0]:=f(X[0]):

s:=0:

for i from 1 to N do

  s:= s+Y[i-1]*dX; #linkersom

  X[i]:= X[i-1]+dX; Y[i]:=f(X[i]);

end do:

 

 

xi en yi worden opgeslagen in een array  en word ook een som gemaakt s als in het voorgaand vb

task 2

 

vb 3.2 : riemann som met graphics (linkersom)

with(plots,display);

[display]

(2)

Before we can do any calculations, we need a function  f  to work with, so we choose the following polynomial function and use the interval [0, 1]:

 

a:=0;b:=1;

0

 

1

(3)

 

f:=x->x^2-x^4+1;

proc (x) options operator, arrow; x^2-x^4+1 end proc

(4)

 

The staircase pattern consists of "treads" and "risers" and we will produce the plots of these as we do the calculations.

The initial computations are done with N =10. The partition points x are stored in an array X and the values y = f (x) are stored in an array Y. The tread/riser plots are stored in an array called tr.

 

N:=10;

10

(5)

X:=Array(0..N); Y:=Array(0..N);tr:=Array(1..N);

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

 

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

 

Array(%id = 18446745233214237262)

(6)

 

Next we calculate Delta*x = (b - a) / N, assign values to x[0],  y[0] = f (x[0]), initialize the summation variable s, and plot the left-hand vertical part of the outline, which is stored in ver0.

 

dX:=evalf((b-a)/N);X[0]:=a;Y[0]:=f(X[0]);s:=0;

.1000000000

 

0

 

1

 

0

(7)

ver0:=plot([[X[0],0],[X[0],Y[0]]],color=magenta): #verticale lijn bij x0 = a (intervalgrens)

 

Now we can do the main calculation of the left-hand rule Riemann sum and produce the remaining parts of the outline with the following do loop:

 

for i from 1 to N do

  s:=s+Y[i-1]*dX:

  X[i]:=X[i-1]+dX; Y[i]:=f(X[i]):

  tr[i]:=plot([[X[i-1],Y[i-1]],[X[i],Y[i-1]],[X[i],Y[i]]],color=magenta): # plot van trapje is 2 lijnstukkken ( 3 punten)

end do:

verN:=plot([[X[N],0],[X[N],Y[N-1]]],color=magenta): # verticale lijn bij x= b (interval grens)

hor:=plot(0,x=a..b,color=magenta):

p:=plot(f(x),x=a..b,color=black,thickness=2):

 

display({seq(tr[i],i=1..N),hor,ver0,verN,p},scaling=constrained,axes=none);

 

 

 

Opgave 2(i) rechterhandregel (via bovensom : interval van x1 ..N
Bovensom van x1..N
Ondersom van x0 ..N-1

 

with(plots,display);

[display]

(8)

Before we can do any calculations, we need a function  f  to work with, so we choose the following polynomial function and use the interval [0, 1]:

 

a:=0;b:=1;

0

 

1

(9)

 

f:=x->x^2-x^4+1;

proc (x) options operator, arrow; x^2-x^4+1 end proc

(10)

 

The staircase pattern consists of "treads" and "risers" and we will produce the plots of these as we do the calculations.

The initial computations are done with N =10. The partition points x are stored in an array X and the values y = f (x) are stored in an array Y. The tread/riser plots are stored in an array called tr.

 

N:=10;

10

(11)

X:=Array(0..N); Y:=Array(0..N);tr:=Array(1..N);

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

 

`Array(0..10, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0})`

 

Array(%id = 18446745233214192806)

(12)

 

Next we calculate Delta*x = (b - a) / N, assign values to x[0],  y[0] = f (x[0]), initialize the summation variable s, and plot the left-hand vertical part of the outline, which is stored in ver0.

 

dX:=evalf((b-a)/N);X[0]:=a;Y[0]:=f(X[0]);s:=0;

.1000000000

 

0

 

1

 

0

(13)

ver0:=plot([[X[0],0],[X[0],Y[1]]],color=magenta): #verticale lijn bij x0 = a (intervalgrens) #aangepast

 

NULL# rechter riemann som

 

Now we can do the main calculation of the left-hand rule Riemann sum and produce the remaining parts of the outline with the following do loop:

 

for i from 1 to N do
s:= s+Y[i-1]*dX;  
X[i]:= X[i-1]+dX; Y[i]:=f(X[i]);
tr[i]:=plot([[X[i-1],Y[i]],[X[i],Y[i]],[X[i],Y[i-1]]],color=magenta): # plot van trapje is 2 lijnstukkken ( 3 punten)
end do:

verN:=plot([[X[N],0],[X[N],Y[N]]],color=magenta): # verticale lijn bij x= b (interval grens)

hor:=plot(0,x=a..b,color=magenta):

p:=plot(f(x),x=a..b,color=black,thickness=2):

display({seq(tr[i],i=1..N),hor,ver0,verN,p},scaling=constrained,axes=none);

 

? riemann sum

 


 

Download exc_set_3_task_1_a_b.mw

 

 

@janhardo 

This question is curve handled by a vector-valued function

exc_set_2_task_8_info_bijgevoegd_en_vraag.mw

@janhardo 

Don't know how to start with this asked vector-valued function for a Curve in this task
Could be too difficult for me ?

Note: some background information how to handle Curves

exc_set_2_task_8_info_bijgevoegd_en_vraag.mw 

@Carl Love 

Thanks

The parametric description i can understand with calculus, but with vector-Calculus i should do need more experience.    

@Carl Love 

Thanks

I will look at it

@Carl Love 

Thanks

That awesome power of Maple is is then versatility to program on different ways ?
   

@Carl Love 
Thanks

Yes, too difficult, although it are 2 position vectors ( velocity, accelaration) moving along the Curve and that is rather easy to imagine.
The length of the folium is a lineintegral ?

@Carl Love 

Thanks

I got all sorts of lists , its about list-building with high level commands as i understand it.

@Carl Love 

Thanks

Maybe understandable for me in a easy example.?
The book examples are less demanding for advanced programming ? 

 @Carl Love 

Thanks

I see a example : folium of Descartes made by a vector function 

 

 

@acer 

Thanks

"Taking a list of numeric values L, and producing a list of lists [p,f(p)] for every p in L , is not complicated. In fact it is a quite straightforward and rather basic example of Maple programming".

This formulation makes it clear
Its a principle in teaching: from basic to complicated.    

@acer 

Thanks

Language interpretations are always a issue,that 's a disadvantage, but it is as it is.

Both axes to the very same extent as i can translate it.:

Then the x-axis and y axis are the same. (identical)

 

@acer 

Thanks

I made a summarize already from the ex set task3 last week :done on different ways 
So i can see what the difference is

These commands are complicated although knowing what they intended to do  

Q := map(p->[p,f(p)], L); #  x-values are evaluated in function f

T := seq(plot(df(p)*(x-p)+f(p), x=p-1..p+1, color=red), p=L); ??

 

exc_set_2_task_3_alle_uitwerkingen_via_maple_primes_forum.mw

@acer 

Thanks.
The same scaling that first : both axes in your example with view[ ], they starting with  0,1, .. that one i prefer.

 

First 75 76 77 78 79 80 81 Last Page 77 of 85