Carl Love

Carl Love

28035 Reputation

25 Badges

12 years, 324 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

You need to ask yourself Why solve it? If you were to solve it, would it be possible for you to effectively use the solution, which'll probably be 170 very lengthy expressions? Would it perhaps be better to simply resolve the whole system each time that you have numeric values for the parameters, which'd likely only take a fraction of a second?

@Markiyan Hirnyk The problem that you gave to Mathematica is much easier than the original. Your function, considered as a function of a real variable, is continuous and periodic with an irrational period. Thus the limit superior of the discrete sequence is just the maximum of the function considered as a function of a real variable. Maple can do that with

maximize(sin(x)/(3+cos(x)), x= 0..2*Pi);

You may verify that Maple's simplified answer is equivalent to Mathematica's unsimplified one.

@Lime Juice If you make assignments to an indexed (see ?indexed) name (see ?name), E in the case, it turns E into a table (see ?table) (*footnote). In this case, the table's indices are 1, 2, 3; and its entries are the corresponding expressions that you've assigned. The command entries (see ?entries) returns those entries as a sequence.

Let me know if you understand, and feel free to ask other specific questions.

(*footnote) Therefore, it's not safe to assign to an indexed name such as E[n] and then try to use E itself as a variable or to assign to E. Doing so is a very common source of bugs in user code. But it is safe to assign to E, E1, E_1, E__1. The last of these will display as subscripted in the GUI, which is convenient. These name forms (when they're global) can be easily sequenced with the || and cat operators.

@nunavutpanther I updated my code to remove the use of add.

@vv Once again, we had exactly the same idea at the same time! This time, however, my procedure isn't letter-for-letter the same as yours.

@awass The quotation marks that you used in this line:

  • Cmnts:= “if time goes by then a=2.1” ;

are not normal ASCII characters. They are not the double quotation marks that I was referring to. The correct double quotation marks have numeric value 34, that is, the 7-bit sequence is 0100010. And it must be the same character at the beginning and end of the string.

It's perfectly legal to have non-ASCII characters inside strings and names, but they can't be the delimiters. Indeed, I recently worked on a package where all the internally generated variable names (such as variables of integration) were Chinese characters. The GUIs (including the command-line interface) and most standard text editors handle them just fine.

 


 

@awass 

There are three types of quotation marks in Maple. All are always used in pairs.

  1. The double quote ": These are used to make strings.
  2. The single backward quote `: These are used to make names, which are very similar to strings.
  3. The single forward quote ': These are to prevent or delay the evaluation of expressions. The usage of these is quite subtle, and often frustrating and mind-boggling, especially when multiple pairs are used.

From your description of the problem, I can only imagine that you are using two pairs of single forward quotes (#3 above). If you are using #1 or #2, there should be no problem.

Regarding the storage of true comments: There is a way that was introduced in Maple 2017 (the most-recent version). If that's what you're using, I'll look it up.

@Joe Riel Thanks for the information about objects and modules. So, it'd be more germane to say that a module is simply a container of persistent local variables rather than that it's a procedure with persistent local variables, right?

I have a question about illegal use of keyword static, and this seems like a good place to ask it. Consider this variation of your Incrementer object:

Incrementer3:= module()
option object;
local 
   cnt:= 0,
   ModuleCopy::static:= proc(self::Incrementer)
      self:-cnt:= 0;
   end proc,
   ModuleApply::static:= proc()
      cnt:= cnt + 1;
   end proc
;
end module:

Based on your explanation of static above, I understand why static can't be used with the ModuleApply. My question is Why isn't the illegal usage detected by the syntax checker? The error message doesn't come until you actually try to use the module.

@maxburakho Your system of equations is linear and nonsingular. For such a system, Newton's method is guaranteed to converge to the exact solution in a single iteration. Newton's method involves solving a system of linear equations at each iteration. If the original equations are linear, that's the linear system that's solved anyway.

@Earl 
 

1. Any number can be used as an operator that returns that number:

2.5(x);

2.5

(1)

2(x);

2

(2)

2. Operators can be combined with symbol operators to form new operators:

SetTo0:= lhs-rhs = 0:

SetTo0(x^2 = y^2);

x^2-y^2 = 0

(3)

(lhs-rhs = 0)(x^2 = y^2);

x^2-y^2 = 0

(4)

3. An operator can be used as the first argument to fsolve. This tells fsolve to search for an argument for that operator which would make the operator return 0, or close to it.

fsolve(sin, -1..1);

0.

(5)

fsolve(sin, 3..4);

3.141592654

(6)

fsolve(sin-1, 1..2);

1.570796327

(7)

 

Download Operators.mw

Does that answer your question?

@lucaud The last thing in my already-posted Answer is the triple integral in cartesian coordinates for the volume. Is this not what you need? In set notation (which doesn't have much practical value in Maple), the volume can be described as

{(x,y,z)  in R^3 | -sqrt(1-y^2) <= z <= sqrt(1-y^2), -sqrt(1-x^2) <= y <= sqrt(1-x^2), -1 <= x <= 1}

OMG, I was wrong. Thanks for setting me straight. For positive b, or abs(b), the parabola's vertex and maximum is in the first quadrant.

@Kitonum The points G and H in the original diagram are part of the boundary of the convex hull, but they are not wanted by the OP.

For real b, maximize((b-x)*x, x) is b^2/4, but adding the domain restriction x >= 0 changes that! The maximum of ((abs(b)-x)*x) on x= 0..infinity is easily seen to be 0 because the parabola's vertex is in the second quadrant and the parabola passes through the origin. Unfortunately, Maple's maximize doesn't understand this:

maximize((abs(b)-x)*x, x= 0..infinity) assuming b::real;

returns unevaluated.

I don't fully understand your actual practical problem. In particular, I don't know if it has symbolic constants (such as the b above). If the constants have numeric values, I think that you can solve the problem with Optimization:-QPSolve.

Awesome! It hadn't occurred to me that morphing polygons would be so easy.

First 349 350 351 352 353 354 355 Last Page 351 of 708