C_R

3682 Reputation

21 Badges

6 years, 177 days

MaplePrimes Activity


These are replies submitted by C_R

@mmcdara 

I tought about generating a list of all user defined names. For that a worksheet could be saved and then scanned statement by statement for names in any expression and arguments of procedures/functions. All scanns are merged in a set using union.
This set could be reduced by anames ('user').

This seems to work in principle. However, the indets command I used 

line := " ":
while line <> 0 do
   nm:=indets(parse(readline("input.mpl")),name);
   user_names:=user_names union nm;
end do:
user_names;

is not specific ennough. It captures names but also all other sort of things:


{a, aaa, b, c, false, ln, name, restart, string, user, x}
 

@mmcdara 

Thanks for confirming that my attempt was hopeless. The same seems to be true for anames ()

restart;
anames():
inital_names:={%}:
{anames()} minus inital_names;
anames(`user`)
     {Unit, Units, sprintf, value, _UIUtils, inital_names, 

       debugger/known_lineinfo, debugger/no_output}


                          inital_names

The kernel seems to establish a separate list for assigned user-defined names which is accessible via anames('user').

@nm 
assigned is of course usefull for a particular name that is known. However, often not all names that are defined in a worksheet are known.

I am looking for a kind of unames('user') command that lists all unassigned names that a user has defined. Not all unassigned names the kernel knows. The opposite can be done in with anames( 'user' ): Listing all assigned names a user has defined.

By the way: I did not know the assigned command. The anames and unames help pages, that I new, do not link to the assigned page. On the other hand, the assinged help page links to unames and anames.

@Gabriel Barcellos 

Yes there is.

In the attachment I simplified the "variant" which contained alot of code elements only required to get a formating similar to Rouben Rostamian. The simplified lists needed to be reordered for plotting. This back an forth is a bit unnecessary to generate plot lists.

If you are only interested in point plots, I would put an fsolve statement (to solve for m) and eqG (to compute G) into a time loop and generate all plot points of interest at each time step.

plot_lists.mw

The problem is the Heavyside function which is not contineous. This is a challenge for solvers using the first derivative.
In this case you either use a solver that works with the heavyside function (I don't know one) or you solve for subdomains
 

evalf(subs(Heaviside(_Z - 1433/20)=1,yB_(10)))
                          64.95141449

The above does not work for
 

evalf(subs(Heaviside(_Z - 1433/20)=0,yB_(10)))

It's probably because of the arctan function that has infinite roots (which can be complex) and which is not contineous either. The domain must be restricted again.

 

@Carl Love 

I did not know that a Matrix is also an expression (parameter x of seq).

The evalapply application is something I missed completely. ?evalapply would have been helpfull when I tried to understand the ()() construct. It seems to be impossible to find this help page with a search term. "{" and "[" direct in the right direction but there is nothing for "(" from where a "See Also" could link to pages dealing with function application or round brakets/parentheses. These brackets play an important role in Maple Language but somehow do not seem to fit under the help topics.   

Thank you

@Carl Love 

Interesting way. Is that explained on ?seq or elsewhere?

@acer

On the search for easier ways, I was wondering if a recursive expand could make sense. Something like

expand['recurse'](expr)

Similar to eval['recurse'].

(I would prefer expand because it is more specific than simplify.)

op, with all its drawbacks, is at least easy to get something done and easy to remember.

@grompvevo 

I do not get the error with Maple 2024.1. Which version of Maple do you use?

I would be interested in the invariant you intend to use to test solutions. The invariant could be used to test the symbolic solution below as well

pdsolve({pde, v(a, t) = 0, v(b, t) = 0, v(x, 0) = f(x + 5), D[2](v)(x, 0) = -eval(diff(f(x), x), x = x + 5)})

You could of course use this solution, which is independed from any physical context, for tests as well.

@Christopher2222 

Correct. Probes could be a way to plot variables over time. However:

Probes connect to ports of components. In the case of  a sphere contact only two variables are exportet: dummy (which gives an error) and R which is the radius of the sphere.

But probes are only for plotting. If forces are used for computations within the model (e.g. for a controller) they must be  measured. For such purposes special measuring componets are available but they are not compatible with the ports of a contact element.

The model tree provides an overwelming number of parameters and variables for a contact element but I have not clue how to access this programatically (and what these parameters and variables stand for).

 

@imparter 

Not that I know. I tried a few things using right click.

@acer Got it. Thank you!

I had the idea to plot an array inside an array that contains the caption. plots:-display does not allow this.
The best I can think of in keeping a caption and a plot array together is using a table.

Is that an option for you?


Unfortuneately such a table cannot be exported as jpg.

Looks like that you ask for a missing feature.

plot_array_with_caption.mw

@acer 

This makes sense but I still don't fully understand why in my document, after entering the second time Digits:=30, "is" did not remember the former result with Digits:=10?

@GFY 

You forgot to call libraries and the Eigenvalues were complex. See:

equation915_debug2.mw

First 21 22 23 24 25 26 27 Last Page 23 of 73