How to Return the Exponent

Roger Guay irog at mac.com
Tue Dec 17 22:07:24 EST 2024


Oops. I take it back. It does not work.

	set the itemDel to “^"
	put char 3 of word 2 of "((1234…)^1/x)”

returns blank

Bummer!

> On Dec 17, 2024, at 6:54 PM, Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Thanks for correcting my spelling, Scott. It does work! What’s strange, though is that the script editor indicated green for itemdelimeter . . . I think. I must be going blind!
> 
> Thanks,
> 
> Roger
> 
> 
>> On Dec 17, 2024, at 6:40 PM, scott--- via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> does this work?
>> 
>> set itemDel to "^"
>> put char 4 of item 2 of "((1234…)^(1/x))"
>> 
>>> On Dec 17, 2024, at 6:20 PM, Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
>>> 
>>> Hi Rick,
>>> 
>>> Sorry to confuse you and ChatGPT.
>>> 
>>> In my original example, the user will be able to insert both the digits between the parens and x in the exponent 1/x . And, I want to be able to call back what the user inputted as x . 
>>> 
>>> Something like this does not work:
>>> 
>>> Set Itemdelimeter to “^”
>>> put char 4 of word 2 of ((1234…)^(1/x))
>>> 
>>> …. and I can’t come up with anything that does work. I will try chatGPT, but I think this list is cleverer
>>> 
>>> Thanks,
>>> 
>>> Roger
>>> 
>>>> On Dec 17, 2024, at 12:59 PM, harrison--- via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>> 
>>>> Hi Roger,
>>>> 
>>>> Chat GPT gave me an interesting answer to this question.
>>>> You should try that, then be a little more verbose about
>>>> what exactly you are trying to do here. Even Chat GPT
>>>> seemed a little confused by your question. Of course
>>>> that’s pretty normal for Chat GPT!
>>>> 
>>>> I at least understand you mean the easier way to do this
>>>> with LiveCode. When I asked Chat GPT that question
>>>> it came back with:
>>>> 
>>>> command findX N, Y 
>>>> 
>>>> -- Calculate log of N and Y 
>>>> put log(N) into logN 
>>>> put log(Y) into logY 
>>>> -- Check if logN is zero to avoid division by zero error 
>>>> if logN = 0 then 
>>>> answer "Logarithm of N is zero, cannot compute x” 
>>>> exit to top 
>>>> end if 
>>>> 
>>>> -- Calculate x using the formula x = log(Y) / log(N) 
>>>> put logY / logN into x 
>>>> -- Return or display the result 
>>>> answer "The value of x is: " & x 
>>>> 
>>>> end findX
>>>> 
>>>> Explanation:
>>>> 
>>>> — Example: where N = 1234 and Y = 10 findX 1234, 10
>>>> 
>>>> I hope that helps.  If it doesn’t, blame Chat GPT!
>>>> 
>>>> Rick
>>>> 
>>>>> On Dec 17, 2024, at 3:16 PM, Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>> 
>>>>> Hi folks,
>>>>> 
>>>>> Given the equation (1234…)^(1/x) where x is any digit, what is the easiest way to return x?
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Roger
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list