C_R

2857 Reputation

19 Badges

5 years, 82 days

MaplePrimes Activity


These are replies submitted by C_R

@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!

@nm 

It seems that we both run Maple in the same way. If Maple were a drink, I would say we like it neat. The only difference I see is the natural language package which I installed for a test. I do not use it. I hope timelimit will improve for you with the library change.

@nm 

libnames are the same as in your update. I only have a Physics Update lib. Additionally a Natural language lib and a MapleSim lib.

I do not see a Physics lib (i.e. without update) if it was that what you removed from your libnames.

I also used Maple 2024.2 and Physics version 1824.

However, I am not sure if I understand correctly. Was there additionally to the Physics Update lib a Physics lib that you removed. If so, it could be the reason for discrepancies that we observed on other occasions between our two installations.

This is how the user related libs look like on my machine

You are using VariationalDifferentiation as if it was a Maple command. The output tells that Maple does not know the name

What do you intend to do with it?

@acer 

Thank you for the analysis. Indeed, I intend  to do much more with it than plotting

2 3 4 5 6 7 8 Last Page 4 of 57