Please help, I am batlling for 2 days now with this problem:
I want to replace a text string, say "*" with "#" in a selected text portion in a RichTextBox.
When I use this code:
X = Replace(RichTextBox1.SelRTF, "*", "#")
RichTextBox1.SelRTF = X
it works fine, but when the selected text contains any maths equation object, it does not work properly. (There is always "###" in front of the equation)
I create the square root symbol with MS Word and the I paste it into the RichTextBox, or I open a RTF document containing the symbol into the RichTextBox.
The sentence with the square root was only an example. It could be any equation object (like a fraction).
But anyway, I don't agree about the 2 answers of a square root. If one uses it as in the attachment, it only has ONE answer, because the square root is positive. If you have x^2, then x is plus or minus the square root of x where it can be two answers.
OK, I left out the ^2 in my previous post. What I meant is that if x^2 = 25, then x = + or - the square root of 25 (as you rightly indcated). But if the square root is already drawn as in the attachment, then there is only ONE answer.
if the square root is already drawn as in the attachment, then there is only ONE answer.
is absolutely NOT correct. Your assumption that the "plus or minus" is seperable from the square root symbol is probably due to having used a crappy text book in high school algebra. The "plus or minus" is ALWAYS implied as PART of the square root symbol, whether you want it to be or not.
OK, you made your point. I must admit it's news for me, because I am indeed a maths teacher and 6 text books (one from Canada) and 4 maths teachers whom I consulted fully agree with my view. I must also admit that I'm not familiar with maths beyond school level, so you may be right.
But after all it seems as if the programming issue was lost along the way.
In addition to what I said in the previous post, I found this line coming from the National Numeracy Strategy document in the UK:
(Note the last sentence)
" Students should know that a positive integer has two square roots, one positive and one negative; by convention the square root sign denotes the positive square root."
(This is to indicate that I'm not the only bad maths teacher)
" Students should know that a positive integer has two square roots, one positive and one negative"
Agreed
"...by convention the square root sign denotes the positive square root."
Since when?
Did maths at degree level, and not once if 10 years of schooling did we assume that...
Hang on, you in the US? If you are, then that will explain it. Also, if the maths if for children < 11 yrs then this would also explain it.
Why you using a RichTextBox?
If you used a normal text box you won't have any problems. Rich text boxes, can now and again, have formatting and selected text problems, well not problems, just dificult work arounds
Woka
Last edited by Wokawidget; Feb 11th, 2003 at 07:31 AM.
As you can see, I'm from South Africa. We use this convention (of the positive sign) in Gr. 12 in our country.
Anyway, I use a RichTextBox because I wrote a program for teachers without MS Word to set Maths papers quickly. As I said in the 3rd post, I don't have a problem any more with that. I guess the whole issue developed into a mathematics issue. It was interesting to hear opinions from other countries though.
Hahahahaha, just kicked off a huge argument in our office. I asked what the root of 25 was, and everyone said 5. when I explained that it could also be -5 everyone disagreed. They say a negative * a negative = a negative!!! *shakes his head* hahahahahaha. Has made the day interesting...
Anyways, reread your posts.
What code are you using now, what doesn't it do, and what is it supposed to do. I'll have a play today and try and fix it.
Sorry, while adding a post it doesn't show the Location of users
In the UK it always has a positive and a negative answer, unless you are 8 years old, then uit's just a positive...just imagine tring to teach (-1) ^ (1/2) (Root of -1) to an 8 year old
In fact the constant i, didn't exsist until A-Level Maths (17 years old)...
NO! sqrt(X) has only ONE AND ONLY ONE ANSWER! because sqrt(x) is defined to be a function!!! functions, by definition, gives you one and only one! sqrt(x) is in fact "the principle sqrt" which means the non-negative (because it can be 0) square root of a number! its just like sin^(-1)(0) (aka arcsin(9)) that means x=0. sin^(-1)(0) does NOT RETURN INFINITE ANSWERS, although sin(0)=sin(pi)=sin(2pi)=...=0!!
but on the other hand, if you are asked to solve x^2=25, you would then get x=5 and -5, as seen by x^2-25=0 and (x+5)(x-5)=0
because some functions (ie x^2, sin(X)) are not one-to-one, we restrict the domain of the inverse function so the inverse will be actually a "inverse function", ie by definition only RETURNS ONE SINGLE VALUE.
the next time you say sqrt(25) (or 25^(1/2) ) is 5 and -5, first answer this question, what is sin^(-1)(0)??
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
*SIGH*
sqrt(X) is a computer function. IT CAN'T return 2 values can it!
x^(1/2) ALWAYS HAS 2 ****ING ANSWERS!!! What part of this don't people understand???
*SIGH*
sqrt(X) is a computer function AND A MATH FUNCTION. IT CAN'T return 2 values can it!
x^(1/2) ALWAYS HAS 1 ****ING ANSWER!!! What part of this don't people understand???
This is basic ****ing maths..I give up
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
how many values does arcsin(0) return?
if you punch in 25^(1/2) on your calculator, does it ever give you -5?? does it ever occured to you that your calculator maybe more right than you are??
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
Are you taking the piss?
the answers computers give arn't true answer to maths equations. They are there as a guide, not to solve the problems for you.
Do you know what (-1)^(1/2) is??? that is SqrRoot(-1)...I bet your calc gives you an error! Does that mean it is an impossible number?
The thing is, is that SqrRoot(-1) is the basis of all electronics and computers could not have been designed without this number, which is known as i or j. But according to your computer/calc it doesn't exist!
Why do people reply on computers so ****ing much! A computer is a tool not a solution!
Most maths equations/formulas can't be solved with a computer, only a pen and papers is required!
I know for a fact I am right. I have studied maths to degree level, and to be quite frank this thread is really pissing me off since your only argument is what the answer your computer gives! This is BASIC maths that people get taught at the age of 14, it's not rocket science.
Do some research on it, then come back to me with PROOF that only has one answer....
Out of interest is SqrRoot(25) = AND ONLY ='s 5, then can someone tell me what (-5)^2 is???!!! For ****s sake!
sure my TI-83 does imaginary numbers. first of all, i is not a number. second, i is NOT sqrt(-1). the definition of i is i^2=-1
you need to get your math straight.
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
Last edited by bugzpodder; Feb 10th, 2003 at 04:53 PM.
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
I'm not sure if anyone every answered this question for you, but the reason why the equation was disappearing is that Microsoft Word uses a Unicode Character to represent this value. In Microsoft's RichTextBox Control, they have normalized support for RichEdit v.1 which only supports TEXT and RTF formats. This means that your text form only supports characters in the range of 0-255. The square root character that is generated in Word is probably either an image or a unicode based character. Why is this important? Because the first time you use the following syntax:
VB Code:
Dim t as string
t = Richtextbox1.Text
Any Unicode values would be flattend and images would be dropped. Since there is not value in the 0-255 character set that covers a square root symbol (unless you use a font like symbol, but then, there is only a square root marker because the font has mapped the glyph to the character), you're pretty much out of luck here if you want to design something using VB's Richtextbox since the first time you save or manipulate the results, the data will be lost.
The only way to get around this limitation is to use a Unicode enabled control (like the Forms 2.0 Object -- though you cannot redistribute it), create you're own RichEdit Control, which is time consuming, but I've found to be the best solution (in terms of reusablity) or use a combination of bit and mnemonic representations to show how your program works.
Originally posted by bugzpodder sure my TI-83 does imaginary numbers. first of all, i is not a number. second, i is NOT sqrt(-1). the definition of i is i^2=-1
you need to get your math straight.
Hahahahahahahaha...Oh I can asure you i is a number
If i didn't exist then you wouldn't have the computer you are using to connect to the web on...
I have done Maths for 14 Years, Pure, Applied, Statistics, mechanics, all at advanced level. I do know what I is. Also I did electronic engineering for 5 years, and physics for 7, and without i, or j as it's know in the electronics industry, electronics goes out of the window.
I do know what I am talking about...
I don't give a flying **** what a calculator tells you the answer is, scuse my french, but SqrRoot 25 = + and - 5, 2 distinct answers!
Arcsin of 0 = + - infinity if I am not mistaken...however, I may be wrong, can't be bothered to go a check, and I'm not asking my comp to work it out as it won't give the correct answer...computers and calculators are limited! U have to remember that. You are basing your answers on what a computer tells you. A computer function can only produce one answer, but maths is not a damn computer...computers are based around maths...period!
TPR25: Nice one. Damn unicode characters...boooo...I have never really got to grips with text formatting inn a richtextbox...much easier to cheat and reference word from VB
Originally posted by bugzpodder answer these two questions first:
how many values does arcsin(0) return?
if you punch in 25^(1/2) on your calculator, does it ever give you -5?? does it ever occured to you that your calculator maybe more right than you are??
Since I thought this post was amusing I got my friend to view it who has a degree in maths...this is what he said...Hahahahaha
Your all wrong to various extents
Which fool said "the definition of i is i^2=-1" has he
never heard of
algebra its exactly the same as i = sqrt -1 rearrangements half the
fun
in agebra its exactly like if you said oranges are orange and hes
replied with no, oranges are orange, FOOOOOOLLLLLLSSS
Secondly
The letter (i) is not a number ist shorthand for sqrt(-1) in a
complex
number you get ai +b this is a more correct way of writing numbers
and
follows on as the next largest level of infinities after Real (
infinite
decimal expansion) numbers. ie there are more complex numbers than
there
are real and there are more real numbers than there are rational and
more rational than Pure. This is all tired up in number and set
theory,
there are exactly as many whole numbers between zero and infinity as
there are from negative infinity to positive but there are more real
numbers between 1 and zero than whole numbers between neg infinity and
pos infinty. And many many infinities more between zero and j than
there
are between negative and positive infinty in the Real number system.
Although I have broken one of the rules of maths because " THERE
IS NO
SUCH THING AS NEGATIVE INFINITY" infinity is not a number, it's a
concept, its unattainable it cant have a negative, best way to think
of
it is as a set of all numbers of a particular type, you can have a set
of negative numbers but not a negative set of numbers. But try not to
think of infinity as madness lies within, Literally, the greastest
number theorist of his generation went insane trying to work with
infinities.
Sqrt X always has 2 answers unless its zero, then it doesn't and
functions can have multiple values, you have to choose the value which
makes most sense to the question, eg the product of mary and bobs ages
is 25, they are both the same age, how old is mary? She can be
either 5
or -5 years old mathematically you would get the marks for putting -5,
but the question is also sociological and you know that she cant be -5
coz ages are always positive. Likewise if the question is obviously
looking for a negative answer that's the one you choose.
Polynomials are great, every polynomial is solved by use of imaginary
numbers,
Every polynomial of order Y has exactly Y (imaginary) solutions and
polynomials of value two three and four( quadratics, cubict, quartics)
can be solved using equations. No Equation exists to find the roots
of
all polynomials higher than 4 ( although certain classes of higher
polynomials do have algebraic solutions)
It has been proved that is it impossible to have an algebraic solution
to solve any higher order polynomial
If you think its hard working in the imaginary number field ( two
point
algebra) try doing Relativistic mechanics ( an eight point number
field) instead of constant C = (ai +b). you have C = (ai+ bj+ ck+ dl
+
em + fn +go +hp) and unlike in normal number systems where a+b = b+a
and
ab=ba in complex albebra a+b= b+a but ab does not equal ba
In 8point albebra a+b does not equal b+a t
Originally posted by bugzpodder answer these two questions first:
how many values does arcsin(0) return?
if you punch in 25^(1/2) on your calculator, does it ever give you -5?? does it ever occured to you that your calculator maybe more right than you are??
my calculator has a "bound" thingo ()
you alter the bound so that the result is < 0 and u get a negative result for the square root, if the bound is positive, it gives a positive result.
Maths at school, if we give an answer to say sqrt(25), we write ± 5. They are the solutions and we are not given full marks if we fail to acknowledge that -5 is also an answer.
Just my $0.02
(don't yell at me )
[edit]
some of the stuff i said was written above - sorry
Originally posted by Wokawidget AAaaaaaaHahahahahahahahahahHAHahAhahahHahahHAHahahAHAhahAhAhahah *Breathe* HahahahahahahahahahahahahahhhshAHAHAHahahahaha...*cough* Hahahahahahahahaha....
Sorry, just re-read this post...pure comedy
The human brain is FAR superior than a stupid calculator
Hahahahahahaha...that post has made my day...cheers
Adios fellow comedians,
Woka
it was meant to be comical (somewhat)...
anywayz, let me restate my points as well as make a new one.
1) arcsin(0) = +- infinity?????
YOU'VE GOTTA BE KIDDIN' ME!!! punch that on your calculator. you will get one and only one answer, 0. you've done math for 14 years and you are telling me that?? plus have you ever heard of definition for function?? one and only one value are returned, buddy!!
2) sqrt(x) gives you one and only one answer because it is understood to be the principle square root of x
on the other hand, x^2=25 has TWO SOLUTIONS, one of which is 5 and the other -5
they can be obtained in the following 2 ways:
x^2-25=0
(x+5)(x-5)=0
x=5 or -5
x^2=25 SQRT both sides
|x|=5 (yes absolute value of x is 5 -- sqrt(x^2)=|x| -- absolute value, sqrt(25)=5)
x=5, -5
ok, what else? yes i.
if you check out stuff, sqrt(x) is valid if and ONLY IF x>=0
sqrt(x) is not defined for C. i can give you a contradiction of i=sqrt(-1) but since you don't believe sqrt(25)=5 is the ONLY ANSWER, i don't wish to waste my time since the proof does use that property.
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!
and tell your friend that he's the bigger fool, since i've provided a professional source but he does not trust it.
Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!
Did you know that...
The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!