C_R

3042 Reputation

20 Badges

5 years, 185 days

MaplePrimes Activity


These are questions asked by C_R

Example: Assume expressions assigned to names

xa, xb, xc := y = x, y = x^2, x = x^3

y = x, y = x^2, x = x^3

(1)

where you want to apply a command (rhs in this example) to all names fitting to a certain scheme (here a and c)

seq(cat(x, i), i = [a, c])

xa, xc

(2)

`~`[rhs]([xa, xc])[]

x, x^3

(3)

Combining (2) and (3) in one line

seq(rhs(cat(x, i)), i = [a, c])

Error, invalid input: rhs received xa, which is not valid for its 1st argument, expr

 

throws an error. Although xa evaluates to an equation

rhs(xa)

x

(4)

and

whattype(cat(x, a))

`=`

(5)

seems to do the same.
I have not worked out what the xa is that rhs is receiving in the one line statement (see error).
Since rhs returns xa it does not look like a delayed evaluation.

 

Besides an explanation of what is going on, I'm interested if there is a way to debug what is passed to rhs?

Download cat_in_nested_statement.mw

t is removed from gamma(t)

sqrt(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)

(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2)

(1)

simplify((1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(cos(alpha(t))^2*cos(gamma)^2-cos(gamma)^2+1)^(1/2)

(2)

lprint((1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2)

 

subs(gamma(t) = gamma(t), (1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2)

(3)

simplify((1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2))

(cos(`γ`(t))^2*cos(alpha(t))^2-cos(`γ`(t))^2+1)^(1/2)

(4)

lprint((1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2)

 

NULL

Download arg_removed.mw

Q1: clicking on a variable in the attached I get

What does it mean and how can I fix that when it happens?

Initialisation_diagnostics_error.msim

Q2: Why are initial conditions which are set to "Ignore" listed as "Guess"?

I intend to use the initialization diagnostics to filter a model for components that have initial conditions set. In the attached example (excerpt from a larger model), this does not work the way I want it to (i.e. I don't want P1 to be listed a guess).

Init_diagnostics_ignore_listed_as_guess.msim

Q3: The app seems to be a powerfull tool. Is it explained somewhere how to use the app to debug a model?

How can I achieve something like this (i.e. an output in a worksheet)?

It is important that the variables of the lables match the columns.

In the attached file is a typical dataset. A display of row lables would be optional.

Context: Easier interpretation (of the structure) of a Jacobian and subsequent manual solving the equations of interest that correspond to the rows.

 

Labels_for_sparse.mw

What I want to achieve with a command is the following image, in which the elements of a matrix that are not zero are displayed in black

This can be accomplished with the Browse Matrix Dialouge, but I want to make such images part of the worksheet. (Display of the full matrix is important.)
Context: Re-execution of worksheets will allow for quick verification of changes in Jacobians.

First 30 31 32 33 34 35 36 Page 32 of 39