janhardo

335 Reputation

8 Badges

11 years, 43 days

MaplePrimes Activity


These are replies submitted by janhardo

@Carl Love 
Thanks

Its only limit that has a complex option
By using I in the calculation for calculus is enough ?

We can also get Maple to show the steps of the solution by using the same template of commands as before.

restart;

 

 

x^2-4*x+5=0;
eq1 := %:
if rhs(eq1)<>0 then eq2 := lhs(eq1)-rhs(eq1)=0 else eq2 := eq1 end if:
eq3 := student[completesquare](eq2,x):
if patmatch(lhs(eq3),_a::algebraic*(x+_p::algebraic)^2+_q::algebraic,'la') then
   pp := subs(la,_p): aa := subs(la,_a): qq := subs(la,_q):
   bb := simplify(2*aa*pp): cc := simplify(qq+bb^2/(4*aa)):
   eq4 := x^2+bb/aa*x+cc/aa=0:
   if eq4<>eq2 and eq4<>eq1 then print(eq4) end if;
   eq5 := x^2+bb/aa*x=-cc/aa:
   if eq5<>eq1 then print(eq5) end if;
   rr := simplify((bb^2-4*aa*cc)/(4*aa^2));
   print(x^2+bb/aa*x+pp^2=rr);
   print((x+pp)^2=rr);
   ss := simplify(bb^2-4*aa*cc);
   print(x+pp=sqrt(ss)/(2*aa),x+pp=-sqrt(ss)/(2*aa));
   print(x=-pp+sqrt(ss)/(2*aa),x=-pp-sqrt(ss)/(2*aa));
end if:

x^2-4*x+5 = 0

 

x^2-4*x = -5

 

x^2-4*x+4 = -1

 

(x-2)^2 = -1

 

x-2 = I, x-2 = -I

 

x = 2+I, x = 2-I

(1)

;

solve(x^2-4*x+5=0, x);# Complex numbers are the default numbersystem

2+I, 2-I

(2)

fsolve(x^2-4*x+5=0, x,complex);

2.000000000-1.000000000*I, 2.+1.*I

(3)

 

 

Did not found not yet other commands that you mentioned for complex calculus, that makes it easier for doing math with complex numbers

 

 

Note : the step by step calculation made by Peter Stone makes no distinction in  x1  and x2  as roots , so that's not clear

 

 

int(exp(t*x), x)NULL

 

Int(exp(t*x),x)=int(exp(t*x),x);# page 370 ,calculus volume 1, tom.m.apostal

Int(exp(t*x), x) = exp(t*x)/t

(4)

 

When t ≠ 0, .If we let  t = α+ Iβ , so t becomes now a complex number and equate the real and imaginary parts of equation (4) we obtain some integration formulas
How to do this ? , z= a + bI , it is only by using I that maple is using the complex number system.

t:=alpha + beta*I;

alpha+I*beta

(5)

 

 

Gauss (1777 - 1855) first used the notation a+bi.
"a" is called the real part and
"b" is called the imaginary part.
Also Maple knows this:

Re(2+4*I);

2

(6)

Im(2+4*I);

4

(7)

 

 

Re(alpha + beta*I);

Re(alpha)-Im(beta)

(8)

Im(alpha + beta*I);

Im(alpha)+Re(beta)

(9)

Int(exp((alpha + beta*I)*x), x)=int(exp((alpha + beta*I)*x), x);

Int(exp((alpha+I*beta)*x), x) = exp((alpha+I*beta)*x)/(alpha+I*beta)

(10)

 

Try to find the two integrationformulas ?,   but the idea using I  maple comes in the complex mode

Download complexe_getallen_post.mw

@janhardo 

I will look at all commands , but using them is another story 
Got here book with some examples for signal processing, but never did something with it

@vv 

Thanks

Must look at the dfference betwween  of complexplot
create a 2-D complex plot
and conformal plot of a complex function.

@janhardo 

Only problem is to install the complex.m package for  the worksheets.
Note:  and get the same issue with a package another lessonserie 

@Thomas Richard 

Maybe fractals and i will look in the packages you mentioned

@acer 

Thanks 

i could look in those worksheets 

@Thomas Richard 

Thanks

Yes, the worksheet is made in 2002 by a person who studied at the same time i did for secondairy schools teacher math. 
Only he studied falso or mathematical engineering too at the same time, so trained with Maple
It was possible to follow two studies at the same time, but i was too late and it just finished the second study then when i ask for. ( in fact years too late , i did not knew it)

I think i will be most complex functions , so it will be generally then.
Don't know yet not else what more to do ?

tomleslie 

Thanks

I am wondering if all code in the book is rubbish , that 's why i came up with this example. (checktri) from the book from wich i think this could be obselote code?
If i am able to recognise bad code, then chance it in good code easily, that was the idea.
How to recognise this obselote code then?

So i don't want to learn how to code badly, no of course not  
I will study your made example with a subprocedure in it and  downloaded the programming guide.

Your code example is not the same a s intentend as in the book 
Its about knowing what type of triangle is concerned ( 4 types) and a plot with a normal vector what acts as a help for visualizing ( read ) the plot in the right position 

@janhardo 

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

I think that you're causing yourself confusion by making an unnecessary distinction between procedures and subprocedures.  A procedure B only needs to be considered a subprocedure of procedure A if B directly refers to the locals or parameters of A. In the code that follows, SelectX is a subprocedure of ModuleApply, but maxmin and pluralize are not. SelectX needs to be declared inside ModuleApply, but the others do not although they are used within ModuleApplySelectX itself has a subprocedure, j-> Y[j]=y. Such a procedure is called anonymous because it has no proper name.

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

Using a module definition is for grouping procedures in general and in some case there are also sub procedures involved

@janhardo 

Seems to be all wrong here in this old procedure 

  • It is main procedure with sub procedures , but not together 
  • The need of a module here ?
  • It seems to be wrong programmed with evaln ?
     

druiehoekvb-met_evaln_geprogammerd_fout_dusCD5-3b.mws

@janhardo 

Why i should use :
add( n!/(k!*(n-k)!)*a^(n-k)*b^k, k=0..n);

instead of a do loop ?

Answer: its easier to use a add statement then a do loop statements  , correct?

@tomleslie 

Thanks for your advice and showing the right approach.

its a book from 2002 An introduction to programming using Maple -david betounes + another book too from 2002 ( also there examples of procedures defined with :  evaln ) 

The example procedures with this structure : proc ( ..,evaln , .. ) are problematic programmed then in the book ?
Enclose a example of this more 

druiehoekvb-met_evaln_geprogammerd_fout_dusCD5-3b.mws

@Carl Love 

Thanks

your procedure on saddle point calculation is not set up as a module, why not?

Making a procedure for saddlepoints - MaplePrimes

In BadSqr ( ) procedure  , the command BadSqr is not usable, why using this s variable then?  
without return statement  BadSqr (3,s );  i get 9 
Confusing this return statement whille sqr:=x^2 is the last statement in BadSqr().

BadSqr:= proc(x)
local sqr;    
sqr:= x^2;
   # return
end proc
:

BadSqr(3); 
                               9
----------------------------another example with evaln ----------------------

Example 2.5 (Binomial Expansion)

The following is a short procecure to compute expansions of binomials:

 binom:=proc(a,b,n,result::evaln)
    s:=0;
    for k from 0 to n do
        s:=s+(n!/(k!*(n-k)!))*a^(n-k)*b^k;
    end do;  
    result:=s;
    RETURN()           
### WARNING: `s` is implicitly declared local
### WARNING: `k` is implicitly declared local
  end proc: 

As explained in the book this is a procedure for expanding expressions of the form 
                          "(a + b)^n"

 where n is a nonnegative integer .  There is no output because of the RETURN command.  The expansion is stored in the variable s which is is passed to the output parameter result .  Let's test the procedure on some expansions we know.

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

How to use this procedure is not straightforward 

procedure_binomium_CD2-6.MWS

@Carl Love 

Thanks

I was writing about the first procedure that i posted , not about the procedure made by @tomleslie

@Carl Love 
Thanks

Its a old book from 2002 were i took this example from : the word "module" is not listed in the index of the book 
Groups of related procedures  that's how it is presented in the book.

This book needs then a overhaul of the present programming practice with Maple 
I must see that the structure of your module example is yet not clear for me but: 
A group of related procedures and other code can be put together into a module 
That's the start for me 

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

The code that you're using as examples uses a very bad programming practice: The procedures return their values through parameters declared evaln rather than through the normal return mechanism.

------------------------------------------------------------------------------------
What does this exactly mean  between the -----?

First 8 9 10 11 12 13 14 Last Page 10 of 38