janhardo

860 Reputation

12 Badges

11 years, 254 days
B. Ed math

MaplePrimes Activity


These are questions asked by janhardo

Problem is here how to define the local variables?

Also the formatting of the code is not ideal

There is a error , but if the local variables are good defined , it could vanish    


 

task 6 newtons method

 Newton's Method (see worksheet)

   
 

Tasks:

CDExercises

(1)  Figure 3.9 shows the convergence of Newton's method to a root  r of  the equation sin x - xcos x = 0. This was for x[0] = 5.5 and `ε` = 0.1e-3, and gives  r = 4.503123428, approximately. Obtain a better approximation, as suggested in the book, by using `ε` = .000001. and altering the above code appropriately. Compare your answer with the approximation to r that you get by using Maple's  fsolve command. How close to zero is  E =| f (r)|  for each of these values of r ?

 

(2) Alter the above code for Newton's method and use it to draw the picture shown in Figure 3.10 in the book.

--------------------------------

 

I make a procedure out of it 

f is function

a.. b endpoints interval x -range

e is the cutoff in the accuracy (tolerance?)

N is number of iterations

 

restart:

with(plots,display):

#
# Parameters - change as necessary
#
  a:= 0.8: b:= 2: N:= 100: e:= 0.0001:
  f:= x->x^2-1:

NewtonM:= proc(f, a, b, N, e)
               local n, tps, x0, E, A, x1, ps, x, j,  pf, pic :  
               uses plots:  
   n:=0: tps:={}:
   x0:=2.0: E:=evalf(abs(f(x0))):
   while ( E>e and n<N ) do
     A[n,1]:=x0;
     A[n,2]:=E;
     x1:=evalf(T(x0));
     E:=abs(f(x1));
     ps:={plot([[x0,0],[x0,f(x0)],[x1,0]],color=black,
                 thickness=2)}:   
     tps:=tps union ps:
     n:=n+1:
     x0:=x1:
   end do:
 
 for j from 0 to n-1 do x[j]=A[j,1],'E'=A[j,2]end do;

 pf:={plot(f(x),x=a..b)}:
 pic:=pf union tps:
 display(pic,tickmarks=[3,3]);
end proc:

maplemint(NewtonM);

Procedure NewtonM( f, a, b, N, e )
  These names were used as global names but were not declared:  black, color,
      thickness, tickmarks
  These local variables were used but never assigned a value:  x

 

NewtonM(x->x^2-1,0.8,2,100,0.0001);

Error, (in NewtonM) cannot determine if this expression is true or false: 0.1e-3 < abs(T(2.0)^2-1)

 

 


 

Download exc_set_3_task_6.mw

Could it be correct ?


 

If L= 1.158R  then half of smallest circle is covered  to proof

 

I derived a formulue for this in GX

 

 

 

restart;

abs(((((((L)^(2)*(-1))+((R)^(2)*4)))^(1/2)*L*(-1/2))+(arctan((((((L)^(2)*(-1))+((R)^(2)*4)))^(1/2)*(L)^((-1))))*(L)^(2))+(arctan((((((L)^(2)*(-1))+((R)^(2)*4)))^(1/2)*(((L)^(2)+((R)^(2)*(-2))))^((-1))*L))*(R)^(2)*(-1))));

abs(-(1/2)*(-L^2+4*R^2)^(1/2)*L+arctan((-L^2+4*R^2)^(1/2)/L)*L^2-arctan((-L^2+4*R^2)^(1/2)*L/(L^2-2*R^2))*R^2)

(1)

verg:=%;

abs(-(1/2)*(-L^2+4*R^2)^(1/2)*L+arctan((-L^2+4*R^2)^(1/2)/L)*L^2-arctan((-L^2+4*R^2)^(1/2)*L/(L^2-2*R^2))*R^2)

(2)

subs(R=1,verg);#  

abs(-(1/2)*(-L^2+4)^(1/2)*L+arctan((-L^2+4)^(1/2)/L)*L^2-arctan((-L^2+4)^(1/2)*L/(L^2-2)))

(3)

verg2:=%

abs(-(1/2)*(-L^2+4)^(1/2)*L+arctan((-L^2+4)^(1/2)/L)*L^2-arctan((-L^2+4)^(1/2)*L/(L^2-2)))

(4)

solve(verg2 = Pi,L); # area half small circle with R=1 => 2*Pi* R^2/2 = Pi ,

Warning, solutions may have been lost

 

L must be expressed in R ?

 

 


 

Download de_koe_in_het_weiland.mw

I try to make a procedure for this 

Was it by a example of Riemann sum that  x-values in a array are stored for  numerical value, but in this task it seems that the array must be filled with the symbol x1,x2 , etc 

Should this be needed ?

 

blz64.pdf

blz_65.pdf

excset  3  task4

 

Was it first for a partition about a interval ( example Riemannn sum) that i got  a list of numeric values

 a:= 0: b:= 5: N:= 30: i= 0..N :

X:= Array(0..N, [seq(j, j=a..b, (b-a)/N)]);

Array(%id = 18446745862042054398)

(1)

Now i want  to get a list  of  x-values in Array X ,  starting from  0  to N  :

example: array X =[x0= 0, x1=1/6, ...]

x[i]:= a+(b-a)*i/N; # for i = 0..N # endpoints subintervals

Error, invalid terms in product: 0 .. 30

 

# generate X-values for interval [a,b]

X:= Array(0..N, [seq(j, j=a..b, x[i])]);

Error, invalid input: seq expects its 3rd argument, step, to be of type numeric, but received x[i]

 

 

the values  x1,x2....stored  in Array X are used in further calulations
If there is a need for naming x1= 0 , x2= ..  in the Array A ? , probably not .

 


 

Download vraag_excset3_task_4.mw

  

This exact value of this serie must be calculated with help of a integral and another serie (Maclaurin)

Note: there is Taylor serie and Maclarin is a special case of this Taylor serie. 

The serie is also numerical in Maple calculated , to get a idea of the exact value 

foroum_vraag_3_inleiding.mw 

I enclosed some book taks pdf about alternating series /infinite series and products 
to get a idea what is asked for  

 

blz_62.pdf

blz_63.pdf

blz64.pdf

blz66.pdf

blz_67.pdf

blz68.pdf

 

I must program exc set 3 task 2(i) and 2(ii)

Perhaps too much asked here on the mapleprime forum to come up with the solutions for this programming task ?

I did already some investigation how the code roughly works 
 

Its a graphical programming task to let show the tread-riser outlines for a right -hand rule and mid-pointrule in a graph   

exc_set_3_task_1_a_b.mw

blz_61_exc_set_3.pdf

blz_62.pdf  

First 17 18 19 20 21 22 23 Page 19 of 23