janhardo

375 Reputation

8 Badges

10 years, 79 days

MaplePrimes Activity


These are replies submitted by janhardo

l@Carl Love 
Thanks
The length of the tangentlines are +- (b-a)/2n  for a given interval 
This can be a plotoption then.

n is number of tangentlines to make it general, but the task was for 6 tangentlines : a interval a b divided in 5 subintervals.

I will try to make it general the procedure for any number of tangentlines
 

@janhardo 

Tried to make as procedure Tangentlines( f,a,b) input : two number a , b as interval, but failed.
Note : in Holland we are used to one Capital letter for words : example: Raaklijnen is (TangentLines)
 

I succeeded in adding the x-valus for the tangentpoints and adding a legenda in the procedure.

betounes_ex_set_2_opg_6via_codeexample2.3_uitwerking_ac.mw

 

 

 

@Carl Love 

Thanks

Good to point this out and keep in mind 

@acer 

Thanks

Indeed a interesting question: what using a expression or function in a procedure definition?
But reading your post its rather complicated to judge when to use a expression or when a real function

My initial idea was to start with the procedure definition using a and b , startpoint and endpoint of the interval 

proc( f, a::numeric,b::numeric ) ,but then i noticed the range example.
Its only a,b or a..b for procedure input ,without telling what are they standing for in the procedure for a new user. 

@Carl Love 

Thanks!

I will try do my best more on my English and beware to ask a open question , because its confusing.
It was not that i ask for sure to you, to give a partial sum procedure, but got one, thanks for that.

Outcomment is text or code with # or with  /*   */ , the idea that the code is bypassed then.

Note: i tried /*  */ in a do loop contained in a procedure, but that is not working. 
Concerning the summed up issues : all points need more study from my side 

But seeing in example makes more clear.
This code example ,must be reworked

PR:=proc(A,N)   # PR is product
   p:=1;
   for i from 1 to N do p:=p*A[i] end do:
end proc;  

@acer 

Thanks

I study all the attachments.

I am aware of the expression or operator input for a procedure that they differ, how could it go wrong?

  

@acer 

Thanks

Yes, i add a pointplot and extent the array ,but forget to adjust p[0] into p[0,1] 

I took a working procedure from you with maplemint no errors and then with my not working procedure with maple mint with errors and compare.

Its the first time i add quotes ...(could it be that i took old original code from example 2.3 again without quotes, that happened i think)   

That rng::range(numeric definition)  is not precisely explained how it works ..it is in Maple help ?

Evaluation rules the books give explanation about levels and the procedure variables are also different evaluated then in a interactive session.
a=b,b=c,c=d,d=16 is evaluated at   a=16 this is fourth level of evaluation in a interactive session as example.

 

 

@acer 

It was more difficult then i thought to make this procedure Tangentlines(f,a..b), but it is not working as intended.

betounes_ex_set_2_opg_6via_codeexample2.3_uitwerking.mw

@janhardo 

@acer : I leave it to you to add the interval as an additional parameter for your procedures.

You made a procedure out of task (exc set 2 task 3: drawing 6 tangentlines in the inflection points of  f ). 
Now there must be made a procedure from a code example 2.3 (tangentlines at maxs or mins) in book , that was the do task.
But it is now drawing tangentlines for a interval divided in 5 sub intervals with a procedure. 

 

betounes_ex_set_2_opg_6via_codeexample2.3.mw

I am working on it.

maplemint(Tangentlines);
Procedure Tangentlines( f )
  These names were used as global names but were not declared:  black, color,
      thickness, x
  Ineffectual call to with() inside a proc at statement 10: with(plots)

@acer: I suggest that you also add the name x as a local to your procedure, if you intend to continue to utilize it as a dummy name therein. Otherwise your procedure will not work if the name x has been assigned, say, a numeric value at the higher level.

Can you give a example with the procedure ? 
 

 

@janhardo 

Don't know how to make from this factorial function suitable for set and list elements

Factorial:= (n::nonnegint)-> local r:= 1, k:= 0; do r*= ++k until k>=n;

-------------------------------------------------------------------
PR:=proc(A,N)   # PR is product
   p:=1;
   for i from 1 to N do p:=p*A[i] end do:
end proc;

A is a list or set or array

example:

A:=[1,2,3,4];
c:=PR(A,4);
 
To make a factorial 4! from the list A you must fill it with natural numbers : that is not handy

@janhardo 

I am looking now at the factorial definition :

Factorial:= (n::nonnegint)-> local r:= 1, k:= 0; do r*= ++k until k>=n;

or as 2D math input makes a big difference in reading!

for example: n::nonnegint is n element of set Z with 0 and positve numbers elements: 2D is showing the symbol notation 

Is it possible to outcomment 2D math too as with Maple input : # and /*..*/

@Carl Love 

An alternative formulation is

SumList:= (L::list(algebraic))-> 
    if L=[] then 0 else local S:= 0, x; for x in L do S:= S+x od fi
:

This is not looking here above anymore on a procedure definition with proc().. end proc;? 
But it seems to be a procedure. 
Its function made by the operator -> then.

Another point about a while clause of the do statement in relation to summing up a list of numbers 

I can take a partial sum of the list,therefore should be needed a while clause  

@acer 

Thanks

Amazing the root finding. 
After such a long time after 2002 (book),  i  could aspect  that fsolve is surpassed by other rootfinding methods  ?

It's specialized knowledge:numeric rootfinding methods.
I can't  go further  in detail for all sort of functions to use in this procedure, right now that's why my attention goes to other things like maplemint.

 

@Carl Love

Thanks

Get now a good oversight of some loop types

I will study your examples more extensive in Maple   

@acer 

Thanks

Looks great the procedure  when i fill in a function, but by the second one there is a error  message
Error, (in RootFinding:-NextZero) can only handle isolated zeros

It means that there will be limit in what sorts of functions i can enter in the procedure  
example :  sin(x)-x*cos(x)  ..ok and add tan(x) :  sin(x)-x*cos(x)+tan(x)-> error 

I study further with maplemint, because i don't now what rootfinding method to use further ? 

 

 

First 39 40 41 42 43 44 45 Page 41 of 47