janhardo

745 Reputation

12 Badges

11 years, 137 days

MaplePrimes Activity


These are replies submitted by janhardo

@Carl Love 

Thanks

You can outcomment this and then the procedure get a error.

return A[1..n+1,..], P; in NewtM ac.mw has to do with of (R1,P1):=NewtonM(g,-1,1,1,100,1e-6):?

A is a matrix and P is plot , so this ( ?  ):=procedure ( )  ?  

@janhardo 

The use of return statement is not clear : when to use?

  • return x0;  in exc set task 6 ac .mw 
  • return A[1..n+1,..], P; in NewtM ac.mw

Use of (R1,P1):=NewtonM(g,-1,1,1,100,1e-6): in NewtM ac.mw 

R1; 

P1; 

Seems to split the output of the procedure? 

@mmcdara 

Thanks

This programming of NewtonsMethod is more complicated then programmed on the forum :
showstat(NewtonsMethod);

NewtonsMethod can be used for a idea how its as plot presented to users in the forum programmed version

@acer 

Thanks

That's really programming you did with NewM compared with the book
It shows exactly about the iterations and values and gives insight .

"You wrote "I am leaving most of the rest as it was, and not addressing the inefficiency of augmenting a set with each new plot, or cleaning up the role of A, and so on.

Well that's probably too complicated for me .

Why is there a print command used, while it always with display was? ( was in a earlier code example)

Note: this last NewM is different programmed then the book example   
And there is solve ! (tough)..i tried 3 x times and go then to fsolve

Context sensitive command for solve : selecting the function and Maple shows the solve ( this is possible in the interactive worksheet )..no solution

Ah ,yes of course fsolve ...via contextmenu possible sin(x) - x*cos(x) ?..no
A shortcoming ? 

@acer 

Thanks

Did some more with it


 

 

 

Download exc_set_3_task_6vb_boek.mw

@acer 

Thanks

Looks great and you corrected a lot.
That's is the pittfall when i took over the static code for a procedure  : must analyze better it for the all involving variables.
 The search interval start with a initial value: xinit 

Following the book example for : NewtonM(x->x^2-1,0,2,2,100,1e-4); (parabola )


 

@Carl Love 

Thanks

Maplemint has not detected a variable T a function of x, T:= x->x-f(x)/D(f)(x):

Its corrected, and it was indeed Newton's iteration function as you mentioned.
It was defined at the top of the example worksheet and i did not a solid check for all local variables ( not aware )    

Now i can answer the questions

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
                       "epsilon = 0.0001"

, and gives  r =
                         "4.503123428"

, approximately. Obtain a better approximation, as suggested in the book, by using
                           "epsilon"

 = .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.

The procedure is correct working

exc_set_3_task_6.mw

@Carl Love 

About the formula defintion for the chord section : 

 "The final result for the area must include arc-functions" 

For me it is not direct clear why is that arcsin appears in calculation : it is a angle in radians
If the final reslut has used earlier arcsin result , yes then it goes further in the calculation: make this sense ?  

@tomleslie 

Thanks

I will study examples of this in my worksheets tasks again and using help ( elementwise).
I reread post from you too ( its not possible to link this post here? : a handy feature of a forum)

Ah yes it can be linked of course https://www.mapleprimes.com/questions/229763-Righthand-And-Midpont-Rule-For-Riemann-Sums-#comment269722

Another useful comment about he likewise ~operator

@janhardo 

Some things are left:

- return display  : when using this ?

- role of [ ] in 2 examples ?

yv:=unapply( f, indets(f, 'name') [ ] )~(xv);   


plot
                            ( f,
                              indets(f, 'name') [ ] =a..b,
                              color=red
                            ),
- p,L:=approxL( f, a, b, N):    p, L  ?  


 

@tomleslie 

Looking again to the code.

I aspected that yv  -values of f  should be stored in a array, but that happened here.

yv:=unapply( f, indets(f, 'name')[])~(xv);

But there is not Array made for this at forehand , well perhaps it has to do with the  ~ (xv) operator
It depend then from what datacontainer type( source container)  is used by ~(xv) ?

In this case it was a Array ,but was it a list then you get probabably a target datacontainer  list?   

Its s strange symbol [ ], it can also used as a range ? [ ]= a..b

plot
                            ( f,
                              indets(f, 'name')[]=a..b,
                              color=red
                            );

Than there is also return display   why is this ?

The procedure is p, L: = approxL( f, a, b, N):  were stands p, L for ?

So i am unsure about the [ ] used to free a variable from a set  and used a range [ ]=a..b

And unsure about the ~ operator about source datatcontainer to target datacontainer

 

 
 

 

 

 

 

 

@tomleslie 
Thanks

Very helpful.

Seems that [ ] is used for {x} to get into x  for the right function definition
Its a good idea/approach  to strip elements of the commando and to see what it actually does with the outcome.  

 

@Carl Love 

This basic derivation for a chordal segment there is used arcsin why not  sin ? 
Makes it difference in a calculation.

Its is more userfriendler to use in calculation degrees , and the central angle is measured in degrees in the basic derivation. 

@Carl Love 

I am trying to figure out further this command

So the command yv:=unapply( f, indets(f, 'name')[])~(xv) basically means

  1. figure out the name of the idependent variable in the expression 'f'
  2. Using 'f' and the name of its independent variable, convert these to an appliable function
  3. Apply this function to every element in the container 'xv'

yv is now  a Array filled with y-values of f  , its construction of yv to a Array is by using [ ]  
Using this  [ ]  how ?  

 

@dharr 

The plot is showing the right result, good.

Takes a lot of time to proof geometrical results in Maple, but its no problem   

First 64 65 66 67 68 69 70 Last Page 66 of 79