janhardo

540 Reputation

11 Badges

10 years, 302 days

MaplePrimes Activity


These are replies submitted by janhardo

@Carl Love

Thanks for the explanation of the do loop where you started with on this thread.
Complicated ...at first sight

The other loop examples seems to be easier to understand, but still left room for me to ask some  question about the innerworking of the loop in a procedure.
Let me first try to understand the do loop hereunder and then go again to another explanation of the do loop from you. 

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

@janhardo From closely reading your loop attempts, I see that you're really struggling with it. Here's a simple straightforward procedure with a loop to sum the elements of a list of arbitrary length:
-----------------------------------------------------------------------------

SumList:= proc(L::list)
local S:= 0, i;
    for i to nops(L) do
        S:= S + L[i]
    od;
    S
end proc;

-------------------------------------------------------------------------------
Please study this thoroughly and let me know if you have any questions.
----------------------------------------------------------------------------

Indeed i am struggling with SumList procedure ( in general with do loops now) to add a list of  2 numbers 1,2  with outcome 3 
L::list   = input parameter L in procedureand  must be a list as datatype
L:=[1,2]  

local S:= 0, i;  local variables S and  i used in procedure
S is sum of list L and i is index varialble of do loop.

I is a index variable in the do loop : don't know if this i starts on 0 or 1 ?

ops(L) is the number of elements in the list : here two in L:=[1,2] 
So i cannot start on 0 ( there is no 0 th element in List L ), there is 1, and 2

Don't know why i should use this : S:= S + L[i]  and why not S:=L[i]  ?
od; is a shortcut for:  end do 
S  stands here alone  only for ? 

Let me see how i get this little  procedure working in Maple

@Carl Love 

The task was:
a) Sum all numbers in a list 
b) Calculate n! , where  n is positive integer 

Try to follow again from the start solutions and following the other writings

a)

SumList:= proc(L::{list, set})
local r:= 0, x;
    for x in L do r+= x od;
    r
end proc:

b)

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

 r+  is  summing up by 1 for a integer number (natural numbers)?

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

@acer 

I found my earlier stored worksheet back as reference and make some notes.
I remember some rootfinding commands ( student-calculus package ) for a function and this  ..

************************************************************************************
As far as I can tell the author of your book prefers using loops and Arrays, even for things which seq and map would make somewhat simpler
*********************************************************************************.
So i keep this in mind for if i start possible again with new procedural programming

@acer 

Thanks

So not using anymore a array , but Array instead with a capital then.
But in my old examples of programing procedures you advise to program the procedure on a another way and don't use array as datatype here ? ( in 2020) 
Probably (for sure) was it a easier way of programming the procedure as you did.  
Unfortanely i did not focus on this other way of programming  and went on wit the exercises, but they became hard to solve with more advanced calculus ( series ), so i stopped.  

I am still curiuos and maybe i can make a overhaul of the already made exercises and see there..

@Mac Dude 

If you are really after learning how to write procedures in Maple, there is no better resource than the Programming Guide. Sections 1.4 and 6 are relevant here. I do not understand your assertion that questions have no answers, maybe because I do not know your questions.
========================================================================

In the past here on maple primes forum , i tried to learn  program procedures by using a book, but the used programming in this book seems to be obselote as @Acer forummember pointed out to me.
Now i must find out what the present procedure programming approach is again..probably it has to do by using what datastructure ?
In this book they use array's a lot and it should be beter to use another datastructure in Maple?

I must reread the old post again

@tomleslie 
Thanks
There is not a formula known (yet), what can predicts a next coming Mersenne prime.(as the Merssene formula shows) 
The prime numbers are endless, but not for Mersenne primes. ( how to proof this this ..)

Suppose there was a formula, then the whole problem of finding the largest prime number is solved.

Left over..

- Stronger caculation capacity computer
- Optimal algoritme for finding Mersenne primes
- seek strategy 

On 19 sept1983 the largest prime number was  2^132.049  -1   ~40.000 digits

Its about 1 sec for 919,142  prime p , but if you search in steps you need less seeking time ? 
132.049/ 919,142 = 2.39 min, but the calculation becomes larger and larger by increasing number. 
fascinating: GIMPS - The Math - PrimeNet (mersenne.org)

@tomleslie 

Thanks,
Interesting programming.

I looked at the GIMPS (great internet Mersenneprime search)

If you do want to use the program GIMP : 

The Most importantly, you will need a lot of patience. Roughly speaking it will take about a month to run a single primality test – visit the benchmark page for a more accurate estimate on your computer.

Seems to be revolving about the Mersenne numbers formula: there are primes in the formula what gives a prime number and some do not .
What is a Mersenne number in the sieve programming ? :  Mn= 2^n-1 
M3 (mersenne number 3) is 7 ..is a prime
M11 = 2047 =23 . 89 is not prime

So if the procedure shows what are Mersenne numbers, then we can calculate how much time Maple  needs for finding the Mersenne primes ?
But easier is  probably to use the Mersenne formula directly?
Mersenne Prime Discovery - 2^82589933-1 is Prime!

Using this in the procedure of the sieve :

Lucas–Lehmer primality test - Wikipedia  ( Lucas–Lehmer test that applies only to Mersenne numbers )

Only 50 Mersenne prime  numbers are till now found yet and because i do want to know more as hobby of the Riemann hypothesis about the distribution of the prime numbers

@Mac Dude 

Thanks,

I am wondering why there no included answers for the exercises in the Maple programming guide..or do i miss something?
Yes, the question is how to start programming this sieve in Maple

There are some interesting answers to study .. 
Let me find the biggest prime in the world and there are enough of them. .:-)  

@Preben Alsholm 

When i open a old  .mws worksheet for Maple V-r4 in Maple 2020 some parts of text with  formulas ( for explaining a topic)
are disappeared)  

The worksheet is not complete anymore, like the original : reading a explanation between the maple input/output     
I do have maple v-r4 also installed and can make a comparison between the two version of the worksheet

You can only notice loss of information this if you use the two maple versions.

@Preben Alsholm 
The old files are .mws files for maple V-r4 they are older  
Got also old studymaerial what has become now useless if i not correct them into the newer .mw format 

@Preben Alsholm 

Thanks
It is not only output what is concerning, but it it is also missing text for clarification
This issue i had with old studymaterial what not can be used anymore in Maple 2020 by missing text.
The only solution for this is adding the text and formulaes by hand then to correct it.  

@Preben Alsholm 

Got here Maple V  Release 4 worksheets and there is a lot of missing text after saving this as .MW  file format 
Is there a way to convert this old worksheets R4  into the newer format ? 
Probably it is not possible i assume to convert it by Maple , so i must correct these worksheets by hand then ? 

 

@nm

Thanks!

I got today the book  Applied Partial Differential Equations with Fourier Series and Boundary Value Problems, 5th ed. Richard Haberman + solutiom manual
Elementary Differential Equations and Boundary Value Problems, 10th Edition. William E. Boyce,200e Richard C. DiPrima do i have also

One book left to get
Looks promising the book from author Richard Haberma, because it starts not too technical and is written for education

Problem with this studymaterial( or other new ) is to understands concepts, therefore i do have a lot of studymaterial assembled.
Also a book here: : from J.kevorkian  PDE analytical solutions en hopefully i can make modest start with it too : it starts with the diffusion equation with a heated rod like your book from Haberman also starts with.  

   

@nm 

You seems to me a expert with PDE's. 
Do you have recommendations how to study them by myself or is this mission impossble ? 

 

@janhardo 

pdsolve can be used too to show that g(y,z) = h(z)  if  g[y] = 0 (partial derative)
Seems to me one of the most complex command in Maple if i see what the outcome can be ?

A scalar potential exists. Call it f(x,y,z). Then diff(f,x)=A. To find f, integrate A with respect to x, holding y and z constant. 

f := int(A, x) + g(y, z);
              f := y z x + exp(x) cos(y) + g(y, z)


Now diff(f,y) should be B. Obtain that derivative and compare to B.

diff(y*z*x + exp(x)*cos(y) + g(y, z), y) - B = 0;
                         d             
                        --- g(y, z) = 0
                         dy            



This says g(y,z) is independent of y, so g(y,z) = h(z), a function of z only. That makes f become

This result g(y,z) = h(z), could be done with pdsolve too
pdsolve(diff(y*z*x + exp(x)*cos(y) + g(y, z), y) = B);
                        g(y, z) = _F1(z)

 

First 39 40 41 42 43 44 45 Last Page 41 of 65