C_R

3412 Reputation

21 Badges

5 years, 316 days

MaplePrimes Activity


These are replies submitted by C_R

@Scot Gould 

Not only has the speed improved, but the functions that I was convinced that work are back as well

@Carl Love 
I was looking for a construct that only lists names displayed to the user and/or used in a session (i.e. names added after start up)
 

# works in 1-D Math input
dsolve(diff(y(x), x, x) = 2*y(x) + 1);
{unames()}:
has(%,c__1);
has(%,_C1)

The above set of names can be used to scan for existing displayed c__n. However, I did not propose it because @nm was interested in _Cn that he wanted to add. These do not seems to match the c__n displayed. I could not figure out a link been made between these two types constants to make it usable for nm.

Compiling a set of names takes time and filtering by an initial set of names (using minus) did not work. Do you know why this does not work?

{unames()}:iu:=%;
dsolve(diff(y(x), x, x) = 2*y(x) + 1);
{unames()} minus iu;
has(%,c__1)

In any case using commands like dsolve blows up the set of unames which is not good to keep an overview.

 

@nm 
Here is a fix

sol:=_C22+x-_C3*x+_C2*x^2;
indets(sol,And(symbol, suffixed(_C, nonnegint)));
myconstants:=sort([%[]],length); 
n:=1; 
do n++ until is(_C||n=myconstants[-1]):
new_constant := _C ||(n+1)

By the way: I though that there is "name" command, like anames, which can list all instances of names and names used in values assigned to names but could not find a construct.

 

@nm 

OK, my sorting works only up to 9. Its not a good option.

@dharr 
I think PDEtools:-dchange gets it wrong

I1:=Int(sin(x^4)/(sqrt(x)+x^2),x=0..infinity);
PDEtools:-dchange(x=u^(1/4),I1);
value(%);
evalf(%);

 

@Rouben Rostamian  
FYI: On my machine your solution is 6 times faster compared to restarting the integration after 200 bumps

t:=Time():
[seq(evalf((200*Pi*i)^(1/4)), i = 0 .. 5)]:
range_list:=[seq(%[i] .. %[i + 1], i = 1 .. nops(%) - 1)]:
seq(evalf(Int(abs(sin(x^4))/(sqrt(x) + x^2), x = i)), i in range_list):
add(%);
Time()-t;

What makes your solution interesting is its periodicy. A good starting point for precise approximations (with known error perhaps) that could be evaluated much faster than direct integration. If that is of interest.

@Axel Vogt 

Maybe this example explains better where I am stuck

`^`(`^`(a + b, 4), 1/2);
                                  (1/2)
                        /       4\     
                        \(a + b) /     

This cannot be written with compound procedures (or operators in this case, which are procedures themselves if I am not mistaken). Here is an attempt

(`^`@`^`)((a + b, 4), 1/2);

which can be modifed this way not make it work

(sqrt@`^`)(a + b, 4);

But what can be done if powers other than 1/2 are involved? There seems to be no way to pass extra arguments.

I am inventing now code to show a structure that separates (names of) procedures from arguments (using the % symbol do indicate that the output from the preceeding procedure call is used)

(`^`@`^`)([(a + b, 4)],[(%, 1/2)]);

These examples are trivial. However, sometimes compound procudure calls are quite handy for example to simplify expression, where a sequence of commands expand, factor, normal, simplify, ... are effecitve. However, when extra arguments (for collect for example) are required procedure composition does not work any more.

Maybe there  are other ways than functional programming using the ()() construct to do this. One could think of a procedure with a long list of arguments starting with a sequence of procedure names followed by a stack of parameters that is processed from the left to the right. However, this would probably not be easy to read, although compact.

@yasi add the view option to Roubens answer (here with 0.01 instaed of 0.0001)

plots:-display(plot(x^2, x = -1 .. 1, linestyle = dot), plot(x^2 + 1, x = -1 .. 1, linestyle = spacedash), plot(x^2 + 2, x = -1 .. 1, linestyle = dashdot), thickness = 3, view = 0.1e-5 .. 0.01)

 

Yes on two computers and with two browsers.

I had a suspicion that a VPN connection was responsible for that but his was wrong.

@acer 

Thank you all. This was copied code I modifed to test a triangular domain. I overlooked the restart...

Nice modification of the range by the way.

Just a comment: What makes your example challenging is that "Expression of secondary variables" still contains the primary variables.

I think there is a way if you could provide the equation and tell what the terms with the double bar stands for (i.e. provide the equations). This would make answers easier.

PS.: I also get two images

It's the other way around: You can use ChatGPT from Maple. Have you read this post?

@Rouben Rostamian  

Tricky to get a perfect match. See here for details. I hope I have descirbed your simulation correctly.

I have noticed a dependency on zoom settings (with crtl and mouse-wheel)

 

@Preben Alsholm 

Thank you for confirming. Initially I tought that the effect was caused by the Windows 10 switiching from high resolution  mode to 1920*1080. However I cannot reproduced this at the moment (changing the resolution by hand). Maybe restarting the explorer (which I did for other reasons(network...)) set the system into a state where appropriate fonts are used (that match the display resolution).

I also checked if the effect is related to the use of internal and external graphic adapters (with negative outcome at the moment).

My hypothesis is that (in some system states and/or system configurations) slim high resolution fonts are incorrectly down sampled by software. This erases fine lines.

First 32 33 34 35 36 37 38 Last Page 34 of 67