Board Logo
« Hello there is a problem »

Welcome Guest. Please Login or Register.
Jan 21st, 2018, 12:53am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Hello there is a problem  (Read 633 times)
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3636
xx Re: Hello there is a problem
« Reply #15 on: Oct 30th, 2017, 02:22am »

Valentin,
just change
Code:
    #w.m, "line ";"50";" ";piv(2)+dif*10;" ";piv(1);" ";piv(2) ' Here is not good
    #w.m, "line ";piv(1);" ";piv(2);" ";"550";" ";piv(2)-dif*10 ' And here so
 

to
Code:
'::dif is proportional to line slope
' 1/50 factor is by trial and error
' height is piv2+something, 'something'=slope*length
'but length is not piv1 but (piv1-50). Also opposite length is (500-(piv1-50))
    #w.m, "line ";"50";" ";piv(2)+dif/50*(piv(1)-50);" ";piv(1);" ";piv(2) '
    #w.m, "line ";piv(1);" ";piv(2);" ";"550";" ";piv(2)-dif/50*(500-(piv(1)-50))
 
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #16 on: Oct 30th, 2017, 06:10am »

@: tsh73: Oh yessss !
"1/50 factor is by trial and error"
Empiricism is good; but Pythagoras must turn in his grave and bplus tear off her hair! grin
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #17 on: Oct 30th, 2017, 11:17am »

on Oct 30th, 2017, 06:10am, Valentin wrote:
@: tsh73: Oh yessss !
"1/50 factor is by trial and error"
Empiricism is good; but Pythagoras must turn in his grave and bplus tear off her hair! grin



laugh let me assure you that HIS hair IS safe and intact, even at HIS age!

I also remind you all I got my caveat in early:
Quote:
bplus
Senior Member
ImageImageImageImageImage


member is online

Avatar




Email PM

Gender: Male
Posts: 1188
xx Re: Hello there is a problem
Reply #9 on: Oct 28th, 2017, 8:54pm QuoteModify
Oh shoot, now that I've done it the hard way, with barely an idea for handling different weights, I see a way easier way based on using different weights. wink


Sometimes you have to walk through hell to see and appreciate the beauty of a simple solution.

You can thank me now for providing that hell! grin

You don't think Tsh73 would of came up with that answer before I posted?

Yes?

Well then why didn't he?
hee, hee! wink


PS (another caveat, just in case Tsh73 is actually wrong) I have not checked out his code because I know it's right. If that's wrong, then I doogh wanna B rite. smiley


And so in summary:
1.) Don't worry about bplus hair, maybe use that energy for better things.
2.) Don't worry about about Pythagorus either, it's not like he invented the right triangle and even if he did he still won't be rolling in his grave (not unless he had a little help from his friends).
« Last Edit: Oct 30th, 2017, 11:42am by bplus » User IP Logged

B+
Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #18 on: Oct 30th, 2017, 5:30pm »

@bplus:
Quote:
Oh shoot, now that I've done it the hard way, with barely an idea for handling different weights, I see a way easier way based on using different weights. wink


I'm afraid that with the variations of weight Pythagoras no longer agrees with tsh73 and that the board loses its rigidity again, sending me back to the hell of bplus undecided
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #19 on: Oct 30th, 2017, 6:44pm »

Hi Valentin,

May I ask, why you are drawing two lines? (Don't worry about answering, that was a rhetorical question to get your brain warmed up to what I am about to say.)

I promise you, if you will only draw one line, it will always be straight.

It might not be sitting right at the top of the pivot, but it will be straight! No bad or embarrassing case of the bends ever again. Here in America, someone might add, " ... and that's a fact Jack." and they would make it rhyme.

Let's put Pythagoras aside and bring out Euclid. "2 points make a line." And for some crazy reason when I write that I am reminded of a line from The Moodies,* ...but I digress.

So what are the coordinates of these 2 points?

Well it depends, which ever side is heavier that side will be on the ground, normally if the ground is firm enough, it doesn't matter how much heavier the heavy side is, it will rest on the ground and the other end will be the highest point in the air.

But here is the tricky part, the pivot has to look like it is holding up the up side from whatever place along the ground it sits away from the grounded end.

So basically the pivots position decides how far up in the air the up end rises, NOT the difference in (weight x distance) from pivot, that only decides which end is down. And drawing the condition when both sides balance each other is your well deserved vacation in heaven.

Assuming you went with me through hell, you will see the light of this giant clue I just gave you and easy street will lay wide at the base of your feet and the glory of the heavens will shine in your heart. You will say, "Yes! I can do this. I deserve it! after going through hell with bplus."


* Aha, tracked down that lyric, it was from "In Search of the Lost Chord" > "The Word" >

Two notes of the chord, that's our full scope,
And to reach the chord is our life's hope,
But to name the chord is important to some,
So they give it a word and the word is Om.

https://www.youtube.com/watch?v=wRGJbk4XpYs
« Last Edit: Oct 30th, 2017, 8:50pm by bplus » User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #20 on: Oct 31st, 2017, 02:15am »

Well in practice, you have to reflect angles by making negative or subtracting pi. Not so easy! ATN only gets the angle right if it were in first quadrant.

So maybe this will help (It is severely blinky!):
Code:
'lever test.txt for JB v 1.01 2017-10-31 B+=MGA

global pi, xmax, ymax
pi = acs(-1)
xmax = 500 : ymax = 500

'mouse and key events update globals with latest info
global inkee$
global mouseX, mouseY

nomainwin

WindowWidth = xmax + 8
WindowHeight = ymax + 32
UpperLeftX = (DisplayWidth-WindowWidth) / 2
UpperLeftY = (DisplayHeight-WindowHeight) / 2

open "Lever Test,  press any key for random weights" for graphics_nsb_nf as #gr '<, == change for plug in modules
#gr "trapclose quit"
#gr "font dejavu_sans_mono 10 20"
#gr "setfocus"
#gr "when mouseMove mMove"
#gr "when characterInput charIn"
#gr "down"

'================== plug-in main modules here

lw = rand(10, 1000) 'left weight 10 to 1000
rw = rand(10, 1000) 'right weight 10 to 1000
l = 500            'lever length
h = 50             'pivot height
g = 300            'ground line
'mx = mouseX as this runs
call seyes 3
while 1
    scan
    if mx <> lastmx then           ' if pivot moved
        call hue 255, 255, 225        'clear screen
        call fbox 0, 0, xmax, ymax

        call hue 0, 128, 0            'ground
        call fbox 0, g, xmax, ymax
    end if
    if inkee$ <> "" then    ' key press = new rnd weights
        lw = rand(10, 1000) 'left weight 10 to 1000
        rw = rand(10, 1000) 'right weight 10 to 1000
        inkee$ = ""
    end if
    lastmx = mx                        'save last mouse
    mx = mouseX                        'poll mouse
    if mx < 0 or mx > l then mx = 250  'quit with error

    if mx < l and mx > 0 then   'draw pivot
        call hue 255, 255, 0
        call aline mx, g, mx, g - h
    end if

    left = lw * mx : right = rw * (l - mx)  'which side down carries the day

    '==========  consider level a difference of less than 500 ==================

    if right < left - 500 then      ' left side down
        a = atn(h / mx)
        ex = 0 : ey = g : e2x = ex + l * cos(-1 * a) : e2y = ey + l * sin(-1 * a)
    end if

    if abs(right - left) < 500 then ' level
        ex = 0 : ey = g - h : e2x = l : e2y = g - h
    end if

    if right > left + 500 then       ' right side down
        a = atn(h / (l - mx) )
        ex = l : ey = g : e2x = ex + l * cos(a - pi) : e2y = ey + l * sin(a - pi)
    end if

    call hue 255, 0, 0  'and here is the lever
    call aline ex, ey, e2x, e2y

    call fore 0, 0, 0                    'report numbers
    call back 255, 255, 225
    call at 10, 20, lw;" units weight"
    call at 300, 20, rw;" units weight"
    call at 10, 40, mx;" lngth mult"
    call at 300, 40, l-mx;" lngth mult"
    call at 10, 60, left;" lngth x wght"
    call at 300, 60, right;" lngth x wght"
    call pause 50
wend
wait ' === procedures color, drawing, events very useful subs or functions

sub mMove hdl$, mx, my
    mouseX = mx : mouseY = my
end sub

sub charIn hdl$, c$
    inkee$ = c$ 
end sub

sub quit hdl$
    timer 0
    close #gr
    end
end sub

sub fore r, g, b 'set fore color lines pixels text
    #gr "color ";r;" ";g;" ";b
end sub

sub back r, g, b 'set background color for fills
    #gr "backcolor ";r;" ";g;" ";b
end sub

sub hue r, g, b 'fore and back RGB color system
'hue sets both fore and backcolor for filled graphics commands fbox, fcirc, fellipse
    #gr "color ";r;" ";g;" ";b
    #gr "backcolor ";r;" ";g;" ";b
end sub

sub seyes thickness  'pixel, line, border size for box, fbox, circ, fcirc...
    #gr "size ";thickness
end sub

sub aline x0, y0, x1, y1 'somethimes you might want to spec a pixel longer on end x1, y1
    #gr "line ";x0;" ";y0;" ";x1;" ";y1  'add 1 to end point
end sub

sub fbox x0, y0, x1, y1   'fill box two corners x0, y0 and x1, y1
    #gr "place ";x0;" ";y0
    #gr "boxfilled ";x1;" ";y1
end sub

sub at xPix, yPix, char$  'print a string at pixel x, y This pin point locating.
    #gr "place ";xPix;" ";yPix
    #gr "|";char$ 
end sub

sub pause mil   'tsh version has scan built-in
    t0 = time$("ms")
    while time$("ms") < t0 + mil : scan : wend
end sub

function rand(n1, n2)  'very handy for screen saver like eye candy
    if n1 > n2 then hi = n1 : lo = n2 else hi = n2 : lo = n1
    rand = int((hi - lo + 1) * rnd(0)) + lo
end function

 


So you can see the lever balanced once and a while, if the difference between the left side and the right < 500 length X weight units I considered the sides balanced.
« Last Edit: Oct 31st, 2017, 02:29am by bplus » User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: Hello there is a problem
« Reply #21 on: Oct 31st, 2017, 03:47am »

Solutions come after understanding the problem. I still don't know what we are trying to draw.

If we move the pivot point to "balance" the arm with differing weights the line should be straight! It should not turn. If the arm is "out of balance" it should turn till the heaviest point touches the ground.

A balance arm is never truly in balance, it is only the friction at the pivot point that stops it moving. Because just like float=float no two weights are ever exactly the same. Except in theory.

If it is theory we are showing then drawing of balance / moment arms usually adopt horizontal for in balance and heaviest side down for out of balance.

So I say again, what is it we are trying to draw? If it is a real life model of a balance arm there is little point in modelling the in between states the arm will always crash to the ground. If we are showing a moment in time and the forces present it does not really matter what the line looks like, follow convention and have it horizontal for balanced and down on the heaviest side. That way you only need the ground point the pivot point and the length of the arm to draw the arm.
User IP Logged

Valentin
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 130
xx Re: Hello there is a problem
« Reply #22 on: Oct 31st, 2017, 2:34pm »

@: bplus:
Quote:
Well it depends, which ever side is heavier that side will be on the ground, normally if the ground is firm enough, it doesn't matter how much heavier the heavy side is, it will rest on the ground and the other end will be the highest point in the air.

But the pharmacist trebuchet based on the same principle as our pivot remains in stable equilibrium from several angles depending on the difference in weight.
User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3636
xx Re: Hello there is a problem
« Reply #23 on: Oct 31st, 2017, 2:54pm »

Quote:
But the pharmacist trebuchet based on the same principle as our pivot remains in stable equilibrium from several angles depending on the difference in weight.

Not quite
Below is diagram from Russian Wikipedia on scales
User Image
It says scales actually pivoted as upper picture
So then tilted, one arm increases, eventually coming to the equilibrum.
We modelled middle picture - no stable point.
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: Hello there is a problem
« Reply #24 on: Oct 31st, 2017, 2:54pm »

Now I am even more confused, a centre pivoted pharmacist trebuchet is only ever in balance when the weights are nearly equal. At that point it will lift the heavy dish off the ground.

Usually the other dish will hit the ground, but if you are very careful the friction will allow the arm to rest somewhere in between. The actual resting position is actually a very random position, it certainly cannot be predicted by the weights. It is entirely to do with the friction at the balance point and the acceleration (low) generated by the weight difference.

Again I ask, what are we trying to draw?
User IP Logged

tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 430
xx Re: Hello there is a problem
« Reply #25 on: Oct 31st, 2017, 3:20pm »

I'm so old-school I was brought up using
User Image
The vertical position of the CoG of the arm was adjusted to JUST below the centre pivot, creating high sensitivity ( deflection per milligram difference on the two sides) but ability to be stable with deflection proprtional to difference of weights. Just one of the many things you had to adjust, starting with levelling the case...
Not the same in these days of digital scales...
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: Hello there is a problem
« Reply #26 on: Oct 31st, 2017, 3:30pm »

Ahh clarity....... no weight a moment...
User IP Logged

bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #27 on: Oct 31st, 2017, 4:52pm »

Hi Rod,

Clarity! Good goal! Good Luck! grin

Just to add to the confusion though, I want to remind you all of the Physics idea of coefficient of friction!

You must overcome the coefficient of friction for the scale arms to move at all!

Pretty easy when 1 side is 1 million and the other side is 1.

BUT! when one side is 1.000000001 and the other side is 1.000000002 huh
hmm... the scale has to think about that one
hmm... it must consult the coefficient of friction, "Do I stay or do I go?"

Ha! Finally my college physics pays for itself. cheesy

BTW, I don't think Archimedes thought the idea through when he said he could move the world with a long enough lever, he needed a couple more thinks, I think.

Append: I guess this repeats Rod's reply #24, he's right because of friction the bar does not have to rest perfectly horizontal! There are two frictions:
1) one has to be overcome to get a system moving
2) a usually weaker one has to be overcome to allow a movement to continue.

In college we played with blocks, sliding them down inclined planes. My parents paid thousands of dollars so that I may benefit from such experiences.
« Last Edit: Oct 31st, 2017, 7:47pm by bplus » User IP Logged

B+
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1255
xx Re: Hello there is a problem
« Reply #28 on: Oct 31st, 2017, 7:00pm »

Hi all,

Now that we've had our moment of clarity,
here is a thought for a moment of reflection:

If weights were at the end of suspended springs, what makes the springs bounce up and down for awhile before stability?


Rod
Quote:
Again I ask, what are we trying to draw?


Again, I tell you we are trying to draw a straight line. I know, man, so hard to believe we can't draw a straight line. But it is because Valentin has chosen to do it the hard way by drawing 2 straight lines and tsh73, I am surprised you haven't admonished him for his fool heartiness! Well what can I say, the Russians have always loved the French and so have the Americans, so we should indulge their crazy ways, draw 1 line with 2? Whathuh shocked

And bplus, bplus! is stuck, stuck! with the task of giving the poor guy hell for trying this. Well I guess love has to be tough sometimes. I mean if I didn't care, I could so very easily leave this man to his fantasies of drawing a straight line with two and be off somewhere else getting into some other kind of trouble...
« Last Edit: Oct 31st, 2017, 7:32pm by bplus » User IP Logged

B+
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3636
xx Re: Hello there is a problem
« Reply #29 on: Nov 1st, 2017, 02:37am »

bplus,
you've said:
Quote:
I know, man, so hard to believe we can't draw a straight line. But it is because Valentin has chosen to do it the hard way by drawing 2 straight lines and tsh73, I am surprised you haven't admonished him for his fool heartiness! Well what can I say, the Russians have always loved the French and so have the Americans, so we should indulge their crazy ways, draw 1 line with 2?

The point is we don't need ANY line. We need a line running through pivot.
And sure way not to miss pivot?
Right, start drawing from one!
( just as sure way not to miss target is, well,
User Image
)
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls