janhardo

435 Reputation

8 Badges

10 years, 232 days

MaplePrimes Activity


These are replies submitted by janhardo

@acer 
Thanks

Version FSimp 17-7-2024 has difficulties with assuming ....

FSimp-integration-assuming_Mprimes_17-7-2024.mw

To solve this, you must do it  interactively and follow the proof steps and then construct a method sequenze?

Final FSimp command to do simplifications on a expression
Easy to use 

FSimp_met_method_category_en_t_en_f_en_all_invoer_DEF4-7-2024.mw
Now the procedure must handle this ?

For simplifications as start as a procedure :FSimplify
Cannot be more simple ...
Next stap to do is categorising the methodlist in FSimplify  for applying the best/right methods

EXAMPLES

e:=(*2*sin(beta)^2*) +4*cos(alpha+beta)*sin(beta)+cos(2*(alpha+beta));# another strategy to simplify this answer:s cos(2alpha) 
                       2                                
       e := 2 sin(beta)  + 4 cos(alpha + beta) sin(beta)

          + cos(2 alpha + 2 beta)


e2:=cos(x)^2-sin(x)^2;
                                2         2
                    e2 := cos(x)  - sin(x) 

e1:=sin(x)^2+cos(x)^2;
                                2         2
                    e1 := sin(x)  + cos(x) 

FSimplify(expr, method ( 1, 1..10  as number or range) , metlist( 1..1, 1...10 ,for set false on methods) , methodlist on/off (true or false, default on true) 
#FSimplify(e,10);
FSimplify(e,10..20);
e3 := int(1-(sum(p[i]*(1-exp(-((t-xi)/tau[i]))), i=1..n)), xi=0..t);
                                     /    /
                                     |    |
                                     |    |
e3 := Typesetting:-msubsup(int, 0, t)\1 - \

                                                             / 
                                                             | 
                                                             | 
  Typesetting:-munderover(sum, iequals1, n)ApplyFunctionp[i] \1

                        t - ξ\\\                  
                 uminus0--------|||                  
                        τ[i]|||                  
   - ExponentialE               /// DifferentialDξ


#FSimplify(e3,7); # FSimplify(e3,7,false)no methodlist to see 
#c# try out method 13 
e4:= r^n;
                                   n
                            e4 := r 

FSimplify(e4,13);
------------------
Methods list:
------------------
1: CompleteSquareSteps(e)
2: ExpandSteps(e)
3: FactorSteps(e)
4: ODESteps(e)
5: PartialFractionSteps(e)
6: PowerSteps(e)
7: ReplaceIntSum(e)
8: SimplifySteps(e)
9: SummationSteps(e)
10: TrigSteps(e)
11: Sum(e, n=0..k)
12: sum(e, n=0..k)
13: SumMethods(e, n=0..k)
14: `assuming`([convert(simplify(combine(simplify(convert(e, trig)))), exp)])
15: collect(e, exp(x))
16: collect(e, ln(x))
17: combine(convert(e, trig))
18: combine(e)
19: convert(e, exp)
20: convert(e, rational)
21: convert(e, trig)
22: evala(factor(e))
23: evalc(e)
24: evalindets(e, `+`, simplify)
25: evalindets(e, radical, u->map(simplify, u))
26: factor(simplify(expand(combine(e, trig))))
27: normal(e)
28: radnormal(combine(e))
29: radnormal(evala(combine(e)))
30: rationalize(e)
31: simplify(combine(e))
32: simplify(combine(e, size))
33: simplify(combine(expand(simplify(e)), trig), trig)
34: simplify(convert(e, exp))
35: simplify(convert(e, trig))
36: simplify(e assuming complex)
37: simplify(e assuming rational)
38: simplify(e assuming real)
39: simplify(e)
40: simplify(e, Ei)
41: simplify(e, RootOf)
42: simplify(e, factorial)
43: simplify(e, hypergeom)
44: simplify(e, ln)
45: simplify(e, polar)
46: simplify(e, power)
47: simplify(e, size)
48: simplify(e, sqrt)
49: simplify(e, symbolic)
50: simplify(e, symbolic, power)
51: simplify(e, symbolic, trig)
52: simplify(e, trig)
53: simplify(radnormal(combine(convert(e, trig))))
54: simplify(radnormal(combine(e)))
55: simplify(simplify(convert(e, 'sincos'), constant, sqrt), trig)
********************************************************
Original expression: lc = 3, l = 5

                                n
                               r 

********************************************************
All simplifications:
********************************************************
M13 (SumMethods(e, n=0..k))(lc = 29, l = 74):

                    k                        
                  -----                      
                   \          (k + 1)        
                    )    n   r            1  
                   /    r  = -------- - -----
                  -----       r - 1     r - 1
                  n = 0                      

******************************************************
Sorting by complexity of simplified expressions:
M13 (SumMethods(e, n=0..k))(lc = 29, l = 74):

                    k                        
                  -----                      
                   \          (k + 1)        
                    )    n   r            1  
                   /    r  = -------- - -----
                  -----       r - 1     r - 1
                  n = 0                      

FSimplify_proc_vaste_methodenlijst_DEF_Mprimes.mw

@Scot Gould 

Thanks for the response, 
I like the idea of using a procedure instead of a module ( the with( ) construct) , which is the case now.

The simpler it can be programming, the better, but ease of use comes first.
 I would give it the name FSimplify, because Simplify already exists in Maple and is a protected name

FSimplify( method, metlist , ?,?, options) as a procedure
The method becomes a number and which method to choose from a method list: metlist something like that ?

Can see if I can make a setup of this and look at the ease of use. 

It has actually become a flop programming a Simplify module to go simplify expressions..
Easily adding a method to go simplify an expression failed in the module code.
To keep it simple for a user of the module and not make changes in the code programming itself, that has not been possible, too bad.

@acer 
Thanks for your help.
If this Method added: combine(e, trig) is working and it is possible to add more methods with the command AddMet ,save them, then it could be useful this module programming.

I think i earlier realized the same output, but could not give meaning to it 
Command ShowMet( ) , shows the all added methods , working or disabled ( true or false) 

@acer 
Thanks , all those messages are ?
This is a indication message that the simplification not is done 
It can only be done if combine(e, trig) is in the methods table present

sin(a)*cos(b) + cos(a)*sin(b) = methods["combine(e, trig)"](sin(a)*cos(b) + cos(a)*sin(b))

And indeed if use .., it shows that there is no method combine(e, trig)

e:= sin(a)*cos(b) + cos(a)*sin(b);
               e := sin(a) cos(b) + cos(a) sin(b)

BestSimp(e);

Indeed the string and procedure : example : "simplify(e, trig)" = proc(e) return simplify(e, trig); end proc, as argument of the AddMet command need to transferred to the Methods table and that is the bottle neck here 
AddMet uses the  AddMethodToTable procedure 

How get from outside a new method placed in the Methods table
By hand adding a new method in the methods table works, but more userfriendly is doing it with a command 
( and ideal is a serie of new methods , and one , by range) 

Note: a new methode added to the methods table  must can be set on a true or false( it does not exist, when doing simplications with the methods) status 
AddMet( method, false or true )
ShowMet is command for assigning a status to existing methods ( true , or  false)
ShowMet (1..53, true)
ShowMet(1..1, true)
ShowMet (10..20, false) 

@acer 

Thanks, I can't make anything else out of the module code for now and have updated all the points to add a new (simplify) method to the methods table.
Unfortunately it does not seem to work yet
I tried 9 variants of AddMethodToTable proc, but no adding of a method  to the methods table 
Tried also a expression e = x and the methode: combine(e,trig) seems to exist in the memory, but 
BestSimp(e) will hang on it, of course.

AddMethodToTable := proc(method_name::string, method_body::string)
    local fn;

    fn := eval(parse(cat("proc(e) ", method_body, "; end proc")));

    methods[method_name] := fn;
end proc;

fullSimplify_module_-metoden_toevoegen_werkt_ws_uitzoeken_forum_opmerkingen_corrigeren_A.mw

I tried earlier to get a working procedure for add or removing a method, based on use with a table. 
Thought it was working ? 
This Module code is based on Module_fullSimplify-2_commands_MPforum.mw and uses two commands of it.

Download fullSimplify_module_-metoden_toevoegen_werkt_ws_uitzoeken.mw

@acer 
Thanks, my question has nothing to do with Module_fullSimplify-2_commands_MPforum.mw

It is a general question, there is no need for a worksheet attachment ( i keep it simple) , because i made some further changes also  in Module_fullSimplify-2_commands_MPforum.mw

I get the idea, that it is not clear anyway what my intention of the question is:
In my module there is a list of method names (procedures) and this is used to simplify an expression. 

Now I want to enter new method names in addition to the existing method names in the list of methods already present in the module.

Can do it manually in the code itself, but it seems more user friendly to me to use a command to do this
which takes over manually entering the code into the method list via a command

@acer 
Thanks, its not clear for me how your code can be used , but i will look at it
You asked:  Why not use a table? 
I did use a table earlier  also, but thought with a list it was easier to get the code of the methode names into it 

@acer 
Thanks  
This is existing red code a "methoden" named list in the worksheet.( in a module)
I need a command what adds a new methode as red code expression into the existing list, because this list is used for doing simplifications on expressions.
I hope its clear now.

The desired red code after using a command what has added the TEST methode name( to be made yet )

methoden := [
        "CompleteSquareSteps(e)" = proc(e) return CompleteSquareSteps(e); end proc,
        "TEST(e,trig)", proc(e) return TEST(e,trig); end proc
          ];

How to get the TEST methode name into the list methoden ?
The methoden list has more names in it.

AddMethod("TEST(e,trig)", proc(e) return TEST(e,trig); end proc);


methoden := [
        "CompleteSquareSteps(e)" = proc(e) return CompleteSquareSteps(e); end proc,
        "TEST(e,trig)", proc(e) return TEST(e,trig); end proc
          ];
First 13 14 15 16 17 18 19 Last Page 15 of 57