## 495 Reputation

14 years, 66 days

## Re-modification...

@Kitonum Further changes to Contourplot_with_Labels corrects the problems you identified.

Contourplot_with_labels.mw

## Thank you for your review...

@Kitonum Originally I only intended for this modification to handle curves defined as [f(x,y),g(x,y),x or y] .

Taking your review as motivation, I will try to modify the modification to work with examples such as you have given, namely

[f(x,y),g(x,y),h(x,y)].

## Brilliant analysis...

Thank you for this clear insight.

## Is this a valid example?...

@Joe Riel Are my comments below correct? Does the discrete event below have to contain the discrete variable dv(t)?

DE1 := diff(x(t), t, t) = -x(t)-(diff(x(t), t))+y(t):

DE2 := diff(y(t), t, t) = y(t)-(diff(y(t), t))+x(t):

ICs := x(0) = 0, (D(x))(0) = 1, y(0) = 0, (D(y))(0) = 1, dv(0) = 0:

sol1 := dsolve({DE1, DE2, ICs}, {x(t), y(t)}, numeric, discrete_variables = [dv(t)], events = [[x(t)-1, dv(t) = 10], [[0, dv(t) > 1], dv(t) = -dv(t)]]):

odeplot(sol1, [t, dv(t)], -1 .. 3, title = "Plot of dv(t)", titlefont = [Courier, bold, 14]);

The second event is a discrete event with a conditional trigger and only occurs when a prior event (here the first event) has earlier occurred i.e. if the first event is omitted the second does not occur, even if option event_initial is true. If the action on the second event is halt, the halt occurs but the odeplot of dv(t) shows its value as zero. Why?

## Thank you...

@Preben Alsholm Your suggestion works, but I would still like to know all the capabilities of the conditional trigger feature.

@Rouben Rostamian  Thank you Rouben.

Your use of the Lagrangian probably fits more diverse motion scenarios than mine.

In addition your second order ODEs are directly solvable by Maple whereas I had to manually reduce mine to first order when Maple's dsolve, numeric sent me a message that Maple could not perform this reduction.

## Apt response...

@acer You have supplied an example of what I meant i.e. a procedure invoked by a plot command to tailor some aspect of the plotted display, in this case its color.

Thank you for your effort and I apologize for this delayed reply, I was tied up in family business.

## Looks good!...

@acer I like your code in which the plot command itself accomplishes the rotation of colors around the circle as, at the same time, it translates the circle along the x axis.

Please see my reply to tomleslie where I ask whether this can be accomplished by a custom color scheme as portrayed in the colorscheme help page.

## Many thanks!...

@tomleslie I appreciate your ingenious way of "marching" the colors in arcs around the full circle.

The colorscheme help page contains an example of the colorscheme parameter invoking a separately defined procedure to implement a custom color scheme.

I am intrigued by this but I don't understand what data is communicated from the example's plot3d command to procedure p and what such a procedure must return to the plot3d command.

Can the rotating colored circle be implemented using an analogous method? If possible, then the plot command could itself perform the equivalent rotation and translation.

## Thank you vv...

@vv This integral is from Problem 14 in Paul J. Nahin's book How to Fall Slower than Gravity.

## Thank you for your help....

@Ramakrishnan Much appreciated.

## Success...

@bmartin Thank you for the hint.

The Lagrangian approach outlined in the Wiki article works well with a pivot moving along a variety of 3D spacecurves.

## Excellent...

@Kitonum Please explain why you can ignore the denominators in the solutions to Eq1 and Eq2.