janhardo

435 Reputation

8 Badges

10 years, 232 days

MaplePrimes Activity


These are replies submitted by janhardo

I made a procedure out of this code 
Further improvementt for a start could be a general ODE template for to generate values for the standard ODE's ( using the odeadvisor)
 

"maple.ini in users"

(1)

Odegenerator := proc(V, xi_sym, F_sym, eq_template) ## Engelse versie
    local xi, F, result, a, b, c, sol, Fsol, rows, numrows, eq, eq_check, count;

    # Initialize a list to store the rows for the DataFrame
    rows := [];

    # Counter for the number of generated printf messages
    count := 0;

    # Loop through all combinations of a, b, and c
    for a in V do
        for b in V do
            for c in V do
                # Define xi and F as the specified symbols
                xi := xi_sym;
                F := F_sym;

                # Form the differential equation by substituting the values of a, b, and c
                eq := subs({'A' = a, 'B' = b, 'C' = c}, eq_template);

                # Check the substitution
                eq_check := eval(eq);
                ### for debugging #### printf("The equation after substitution for a = %a, b = %a, c = %a is: %a\n", a, b, c, eq_check);

                # Increment the counter
                count := count + 1;

                # Solve the differential equation
                sol := dsolve(eq_check, F(xi));

                # Check if an explicit solution was found
                if type(sol, `=`) then
                    Fsol := rhs(sol);
                else
                    Fsol := "No explicit solution";
                end if;

                # Add the row to the list of rows
                rows := [op(rows), [a, b, c, Fsol]];
            end do;
        end do;
    end do;

    # Display the number of generated printf messages
    printf("Total number of printf messages generated: %d\n", count);

    # Count the number of rows (for the DataFrame)
    numrows := nops(rows);

    # Create the DataFrame with the collected rows and the correct column names
    result := DataFrame(Matrix(numrows, 4, rows), columns = ['A', 'B', 'C', F_sym(xi_sym)]);

    # Adjust the output limit to display all rows
    interface(rtablesize = numrows+10);  # Increase the limit so all rows are shown

    # Display the result
    ###printf("%A\n", result);

    return result;
end proc:

# Define the list of values for a, b, and c
V := {  0, 1/2  };  # Start with a smaller set to test

# Define the independent variable and function
xi_sym := t;
F_sym := y;

# Define the general form of the differential equation
eq_template := diff(F_sym(xi_sym), xi_sym) = 'A' + 'B'*F_sym(xi_sym) + 'C'*F_sym(xi_sym)^2;

# Call the procedure
result := Odegenerator(V, xi_sym, F_sym, eq_template);

# View the result
###result;

V := {0, 1/2}

 

xi_sym := t

 

F_sym := y

 

eq_template := diff(y(t), t) = A+B*y(t)+C*y(t)^2

 

Total number of printf messages generated: 8

 

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

(2)

 

 

 

 


 

Download ODEgeneratorMprimesforumreactie_18-8-2024.mw


 

My procedure Fsimp uses y(t) only with prime notation, so maybe i can make more general later on, with a fix for de odetest
I like the most @nm 9421 , because the assumption is applied to see on g 

 

Added method:  Odesolve for finding functions with odetest, method= laplace, series and ics 
Odesolve method will be skipped for leafcount and length calculaton ( via a list of exceptions for  skipped methods)
Using prime notation 
Added method: ODEplotseries , makes a direction field with approximation curve (series) ( polynome)
Odetest must be working 100 % ?

FSimp-integration-assuming_Mprimes_17-8-2024DEF_.mw

@MaPal93 
I ask maple coding expert ...

@nm 
"Why is simplify needed to evaluate limit? Is this documented somewhere?"

Because if x = 0 , b remains and a simplify command with assuming option is also possible.
It may be that the simplify algorithm first simplifies the limit question to b? 

"I do not expect that Maple covers everything in teaching"
Well, given the effort Maplesoft is doing for education, so i thought i show my practical examples and wondering.
Jan Douma B Ed math

Maple uses the  form  [ infinity/- infinity]  for  L'Hopital to use  as derived  in another picture , but what is the educational value of this L'Hopital rule ?

Same limit , but  now form [ infinity/- infinity], and Maple goes not further to try to get the value of the limit
This is another form  [ infinity,- infinity]  for  L'Hopital to use 
  

Maple is using SimplifySteps (number 8 in FSimp procedure) here and shows that numerator and denominater are 0 
So, its [0/0]  
But nothing happens further and it should be interesting if L'Hopital is applied and a new limit is calculated 
Limit(-2*x^2*ln(x)^2, x = 0, right), but this is the same situation as for the startlimit 
Another trick is needed.
Perhaps with RuleSteps i get a new( but useless) limit  for the [0,0] ?
------------------------------------
Concerns me if Maple wants to be educational and show in steps of a solution , then also all the steps can be seen in a solution
--------------------------------------



In my FSimp procedure i did SimplifySteps on a limit and in my textbook example l'hopital
Seems to be not clear what l'hopital version is used by Maple ( there are two versions [0/0],[infinity/infinity] )


voorbeeld_Mprimesforum_limiet_lhopital.mw


 

 

@vv 
Thanks, In the most right limit you can recognize some standardlimits 
But how do you know when to use l'hopital ?

With this little investigation ...
But x.ln x for x->0  gives [ 0, infinity ]  = lim x<- 0  x/ 1/ln x = [0/0] (=l'hopital)

lim x<- 0  1/ (- 1/ ln^2.x). 1/x (l'hopital applied, but it seems to go to limit x<--0  gives   x ln x^2 
Its not going better now with this limit

So we need to rewrite  x.ln x again on a second way...

Tried to add limit rules, but don't know how to handle the Calculus1 infolevel 1 and assigning exactly Calculus 1 package with the Uses cmmand  

FSimp-integration-assuming_Mprimes_26-7-2024.mw

Can now handle a sequence of assumptions

FSimp-integration-assuming_Mprimes_21-7-2024.mw

I solved it for integration : undefined or defined integrals are recognised in FSimp procedure 
A integral with  a assumption  can also be used too

"Now, do you understand that the expression
   u::nonnegint
is not itself an integer? Do you understand that the expression u::nonnegint is not itself of type nonnegint?"
yes, if it not is working

FSimp-integration-assuming_Mprimes_20-7-2024.mw

Simplify with assuming is working, but not working is Definite integral with assumption method yet.
( using the definite integral method instead  of it)
Funny enough method 14 seems to be working with a assumption, while it has no definition for it 
The variable of u in the integral is defined in FSimp procedure
Chanced also the FSimp input names for easier handling and  a assumption message 

FSimp-integration-assuming_Mprimes_19-7-2024.mw

First 12 13 14 15 16 17 18 Last Page 14 of 57