C_R

3412 Reputation

21 Badges

5 years, 314 days

MaplePrimes Activity


These are replies submitted by C_R

Uploading the code with the green arrow makes investigations easier.

Without knowing the pde and the initial/boundary conditions its difficult to tell. However, the error message gives already a hint that the timestep for sol2 is too large.

If you want to keep this time step you could try to play with with numeric methods and options. See ?pdsolve,numeric

 

@matmxhu 

It looks to me that the combination of commands have reveald a deficiency of a recently improved implementation. Here is the ouptut from Maple 2022, which shows that compactdisplay was not working at all on partial derivatives


 

I the past Edgardo Cheb-Terrab provided often swift fixes for the Physics package. This might change in the future. Better now to make MapleSoft formally aware of it: https://www.mapleprimes.com/scr/new

 

I hope the physics project will continue.

My best whishes for his future!

@dharr I could expand a bit on your idea. Works well for a single path

Remove

currentdir(); #some path
FileTools:-SplitPath(%);
remove(has,%,"Users");
FileTools:-JoinPath(%)

Replace

currentdir(); #some path
FileTools:-SplitPath(%);
subs("Users"="Utilisateurs",%);
FileTools:-JoinPath(%)

@MaPal93 

Partial derivative of a summation: why it is not just 2*`X__i`?
I am not sure I understand what you mean. Suppose n=3. Then A=X_1^2+X_2^2+X_3^2. For any i from 1 to 3 the derivative is always 2X_i, that is, for i=1 is 2X_1, for i=2 is 2X_2, for i=3 is 2X_3. Why their sum?

Answer: You are correct.

A := sum(X[i]^2, i = 1 .. 3);
seq(diff(A, X[i]) = 0, i = 1 .. 3);
                            2       2       2
                   A := X[1]  + X[2]  + X[3] 

               2 X[1] = 0, 2 X[2] = 0, 2 X[3] = 0

But you did not differentiate w.r.t. X__1, X__2, X__3. You differentiated with respect to X[i] over which Maple summs up.

Partial derivative of a double summation: how to define the nested structure of a double summation where j<>i?
I cannot see how B_wrong is calculated, and Sum it's just an inert form so not that useful. In any case, B_wrong is surely not correct since I never really included the j<>i constraint on the index (the summation over j has to skip j=i). How do I do this?

Answer: I misunderstood what you where after because in your worksheet

B__correct - B__wrong;
                               0


System of n equations: how to define and solve for it?
I wanna solve this generically. That is, if I have n+1 equations where n of them are functions of X_i (and X_j) and the last one of X_r, the output solution is X_i=... and X_r=...  

Answer: I do not think that this is possbile in generic way without letting solve know the number of equations and their structure. My trivial example worked. But this is an exception. There might be other examples which are equivalent to computing the inverse of a nxn matrix which could work. Before speculating too much I prefer to hear wheather Ronan's way suits you. Looks very promissing to me.

@nm Works well. Thank you!

@nm 

I was hoping for Maple setting since I cannot change the username on a managed PC (not my personal).

I have also seen placeholders like "username" but his was perhaps a manual edit.

I tried converting an outupt to a string which removed all the backslashes in the file path. Maybe there is a dedicated command that I overlooked.

@ecterrab

I had a further look at my last observation.

I compared VariationalCalculus:-EulerLagrange with Physics:-LagrangeEquations with the first example of

?dsolve,numeric,DAE. Results:

   VariationalCalculus:-EulerLagrange returns: - A - B = 0

   Physics:-LagrangeEquations returns: A + B = 0

For consistency (e.g. code migration from EulerLagrange to LagrangeEquations) and to make LagrangeEquations for formulations with external forces following d'Alemberts Principle compatible to LagrangeEquations, I was wondering if an option (or something else) for the LagrangeEquations command could resolve the -1 issue.

For engineering applications it is important to calculate forces and displacements using principals involving work and/or energy with the correct sign.

IMO, Maple Physics output should be, as much as possible, consistent when it comes to Fermats principle, principal of least action, principal of virtual work, d'Alemberts principle, the Lagrangian and Hamiltons principle.

For the time beeing, I will stick to manual derivatives or VariationalCalculus:-EulerLagrange with the caveat of removing K from the output (which is more complicated that multiplying the output from Physics:-LagrangeEquations by -1).

If it is already to late to change the design back to - A - B = 0, an option with a default on pretty print (A+B=0) would protect existing worksheets with A+B=0 output from beeing changed. A description of the option in the help page would make the new command Physics:-LagrangeEquations compatible to the use for d'Alemberts principle.

@acer 

Nice play on words. Allways good to have a ray of joy on a gray day. I will remember.

@acer 

your insights are always welcome. I do not understand one detail. Why is executing

time[real](assign('P',plot(fr, 0..10, popts)));

a second time about two times faster?

@WA573 

I have no time to have a closer look. You must check all the derivaties one by one.

For debugging purposes I would remove the alias statement and adapt subsequent statements.

Try for example

diff(S(x, t), x)

and see whether the output is what you want.

@Carl Love 

I did not know this

I think the server needs a restart and/or Mapleprimes has a bug. See here: more than than 10 deleted comments. This does not look like a use error.

@Scot Gould 

This is a valuable option.

I have updated a former question of mine with that information. See: How find out what dsolve,numeric returns

Thank you for adding this.

@acer 

It's not about investigating solvers. I'm trying to analyze a mechanical problem. Right now I'm at the stage where I need to determine the tools/skills required before I begin. I have to weigh clean math in spherical coordinates against the extra effort of calculating derived system states that are not part of the variables of the system of odes. These could indeed be intergrals of system variables. -> 2.)

I have limited experience with solving systems of odes but quites some with approaching problems from the wrong angle;-)  Most likely, I will have some follow-up questions. -> 3.)

As for tools, I have more than enough for the mechanical problem. This post has turned into a rich collection of possibilities that I will probably refer to for other applications.
Thanks again!

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