|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I want to aim a desk lamp by specifying where it should point. P(x,y)
is where to aim the lamp, c is the length of the flexible part of the
neck, a is an additional rigid distance to the central axis of the lamp
hood, and f is the angle to bend the neck. The initial equation was
huge and ugly, but I managed to simplify it considerably, to this form:
(x - c/f) * sin(f) + y * cos(f) = a
But now I'm stuck. Variables a, c, x, and y are given, and I need to
solve for f. I plugged it into Wolfram Alpha, but it gave up. I don't
even know if a paid subscription would find a solution, and I would
hardly use the service enough to justify a subscription anyway. Does
anyone have an idea of how to proceed with the equation? Or should I
gamble that Wolfram Alpha Pro can solve it and pay for one month?
Post a reply to this message
Attachments:
Download 'flex_lamp_problem.png' (19 KB)
Preview of image 'flex_lamp_problem.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 06/08/2022 18:24, Cousin Ricky wrote:
> I want to aim a desk lamp by specifying where it should point. P(x,y)
> is where to aim the lamp, c is the length of the flexible part of the
> neck, a is an additional rigid distance to the central axis of the lamp
> hood, and f is the angle to bend the neck. The initial equation was
> huge and ugly, but I managed to simplify it considerably, to this form:
>
> (x - c/f) * sin(f) + y * cos(f) = a
>
> But now I'm stuck. Variables a, c, x, and y are given, and I need to
> solve for f. I plugged it into Wolfram Alpha, but it gave up. I don't
> even know if a paid subscription would find a solution, and I would
> hardly use the service enough to justify a subscription anyway. Does
> anyone have an idea of how to proceed with the equation? Or should I
> gamble that Wolfram Alpha Pro can solve it and pay for one month?
>
To test your equation, I replaced the a, c, x and y by numerical values.
Wolfram solve the equation but only numerically because apparently there
is not only one solution...
<https://www.wolframalpha.com/input?i=solve+++%283+-+4%2Fx%29+*+sin%28x%29+%2B+5+*+cos%28x%29+%3D+2>
Puzzled !
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2022-08-06 13:32 (-4), kurtz le pirate wrote:
>
> To test your equation, I replaced the a, c, x and y by numerical values.
> Wolfram solve the equation but only numerically because apparently there
Does this imply that I would need to program a numeric solution into my
macro?
> is not only one solution...
I'm only interested in solutions between 0 and pi/2. The plot of the
solution implies that there can be no more than 2 of these. With your
example, I'll naturally want the smaller angle, as the larger angle puts
the aim point behind the lamp!
By pushing the aim point farther from the lamp (the bottom plot), I get
only 1 solution. I'm still trying to work out how to restrict inputs to
the macro to guarantee only scenarios that make physical sense.
Post a reply to this message
Attachments:
Download 'flex_lamp_problem-a.png' (20 KB)
Preview of image 'flex_lamp_problem-a.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 06/08/2022 23:57, Cousin Ricky wrote:
> Does this imply that I would need to program a numeric solution into my
> macro?
I am afraid that it is not possible to solve literally an equation which
makes appear at the same time t, sin(t) and cos(t). A bit like in
differential equations with x and dx.
Literal solutions never exist (except for school cases).
Another trail.
Let sin(x) = T and cos(x) = U, the equation becomes :
(g - c/x)T + hU - a = 0
Wolfram proposes a more "usable" result.
<https://www.wolframalpha.com/input?i=solve+%28g+-+c%2Fx%29T+%2B+hU+-+a+%3D+0>
x = cT/(-a+gT+hU) with a!=gt+hU & cT!=0
Maybe more adapted to your needs ?
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2022-08-07 10:59 (-4), kurtz le pirate wrote:
> On 06/08/2022 23:57, Cousin Ricky wrote:
>
>> Does this imply that I would need to program a numeric solution into my
>> macro?
>
> I am afraid that it is not possible to solve literally an equation which
> makes appear at the same time t, sin(t) and cos(t). A bit like in
> differential equations with x and dx.
Then numerical computation it will have to be, albeit in SDL.
> Literal solutions never exist (except for school cases).
I suspected those examples in high school were conveniently contrived.
> Another trail.
> Let sin(x) = T and cos(x) = U, the equation becomes :
> (g - c/x)T + hU - a = 0
>
> Wolfram proposes a more "usable" result.
> <https://www.wolframalpha.com/input?i=solve+%28g+-+c%2Fx%29T+%2B+hU+-+a+%3D+0>
>
> x = cT/(-a+gT+hU) with a!=gt+hU & cT!=0
>
>
> Maybe more adapted to your needs ?
I'll take a look at it. Thanks!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 07/08/2022 à 19:54, Cousin Ricky a écrit :
> On 2022-08-07 10:59 (-4), kurtz le pirate wrote:
>> On 06/08/2022 23:57, Cousin Ricky wrote:
>>
>>> Does this imply that I would need to program a numeric solution into my
>>> macro?
>>
>> I am afraid that it is not possible to solve literally an equation which
>> makes appear at the same time t, sin(t) and cos(t). A bit like in
>> differential equations with x and dx.
>
> Then numerical computation it will have to be, albeit in SDL.
>
>> Literal solutions never exist (except for school cases).
>
> I suspected those examples in high school were conveniently contrived.
>
>> Another trail.
>> Let sin(x) = T and cos(x) = U, the equation becomes :
>> (g - c/x)T + hU - a = 0
>>
>> Wolfram proposes a more "usable" result.
>> <https://www.wolframalpha.com/input?i=solve+%28g+-+c%2Fx%29T+%2B+hU+-+a+%3D+0>
>>
>> x = cT/(-a+gT+hU) with a!=gt+hU & cT!=0
>>
>>
>> Maybe more adapted to your needs ?
>
> I'll take a look at it. Thanks!
If you like complexity, remember that T²+U² = 1,
so U is actually sqrt(1 - T²), reducing the number of variables.
(of course for your setting T & U > 0)
Back to original problem, why is the c part a circle ?
If it is some flexible part, we are back to the evaluation of the length
of a sphere sweep/spline for which there is no formulae, even when it's
just a part of an ellipse.
Do you really need a fixed length c part ?
Can the right angle of the picture (base of light bulb or so) be on the
y axis, with the c segment describing some S-like shape (or
interrogation dot shape )
Why do I want that point on y axis ? Because it is probably better for
the weight of the lamp to be correctly held.
Which make me wonder why there is a straight part after c, but not below it.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2022-08-15 11:04 (-4), Le_Forgeron wrote:
> Le 07/08/2022 à 19:54, Cousin Ricky a écrit :
>> On 2022-08-07 10:59 (-4), kurtz le pirate wrote:
>>>
>>> Let sin(x) = T and cos(x) = U, the equation becomes :
>>> (g - c/x)T + hU - a = 0
>>>
>>> [snip]
>>
>> I'll take a look at it. Thanks!
>
> If you like complexity, remember that T²+U² = 1,
> so U is actually sqrt(1 - T²), reducing the number of variables.
Actually, I already went through that identity on the way to getting the
equation in the OP. The equation I started with was much more
complicated. I found that reapplying this identity seemed to take the
equation in a direction that I didn't see as productive, and per Kurtz's
reply above, would have been futile anyway.
> (of course for your setting T & U > 0)
Only for this example. I had broken down the flexing problem into three
different scenarios depending on how much the lamp was flexed or
extended, but when I worked through the cases separately, they all came
to the exact same equation. So for my generalized problem, this
restriction no longer applies.
> Back to original problem, why is the c part a circle ?
>
> If it is some flexible part, we are back to the evaluation of the length
> of a sphere sweep/spline for which there is no formulae, even when it's
> just a part of an ellipse.
That is precisely why I am keeping the curve circular. If you want an
arbitrarily curved neck, I believe Bald Eagle was working on that. ;-)
> Do you really need a fixed length c part ?
Yes, that is part of how I'm defining the lamp.
> Can the right angle of the picture (base of light bulb or so) be on the
> y axis, with the c segment describing some S-like shape (or
> interrogation dot shape )
The inputs to my macro are simply the position of the lamp and where it
is pointing. The shape of the neck is not an input I am planning to
include at this time, so I'm just using the most obvious curve to get
the job done.
> Why do I want that point on y axis ? Because it is probably better for
> the weight of the lamp to be correctly held.
I was just concerned with simplifying the math. Locating the origin at
the bottom of the curve made it easy for me to develop an equation
describing the problem. Whatever translations need to be made will be
trivial *after* I figure out the angle and radius of curvature.
> Which make me wonder why there is a straight part after c, but not below
> it.
There is a straight part above c because the hood of the lamp is rigid.
The lamp does have a straight part below c, but I have not shown it
because it can be implemented with a simple translation. There is no
need to involve it in the flexing equation.
Anyhow, as I showed in p.b.i, I did solve the problem. Taking Kurtz's
word that there is no analytic solution, I wrote a solver, and it works
beautifully.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 16/08/2022 05:33, Cousin Ricky wrote:
> ...
>
> Anyhow, as I showed in p.b.i, I did solve the problem. Taking Kurtz's
> word that there is no analytic solution, I wrote a solver, and it works
> beautifully.
I'm back from vacation and this topic is tickling me ;)
Just for fun, I implemented some macros to find the roots of functions
that cannot be determined formally.
I used the methods of Bisection, False Position, Newton Raphson, Secant
and Steffensen
If anyone is interested ...
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|