DC - 6² isn't written 6^2?
-
I tried to write 6² as 6^2 as in most other scripting languages I've used. But that caused an error. What syntax do you use in DC formulas?
-
Ya know, I haven't figured it out yet. I keep faking it with x*x. There is this function:
EXP(number)
The EXP function returns e raised to the power of number.But I don't understand the explanation. I'm intereted in the answer too.
Chris
-
That is strange that ^ doesn't work. I believe this will accomplish the same thing:
EXP(a*LN(b))
Where b is being taken to the power of a.
Instead of =4^3, you can use =EXP(3*LN(4))
...it might only work for positive numbers.
Matt
-
Hey guys,
Support for the ^ operator is on our feature request list, but for now you have to do the math yourself. Let me know if you find any other "standard" spreadsheet operators that should be added to DCs.
-
@Matt you are correct, that will give you the right answer and it will work for only positive values.
If b is negative and a is odd, then you can multiply by -1 to get the correct answer. If a is negative then you want 1/x at the end, instead of x.
So a general formula might be:
b^a = IF(SIGN(a)=1, IF((SIGN(b)=-1) AND (ISODD(a)), -1, 1)*EXP(a*LN(b)), 1/(IF((SIGN(b)=-1) AND (ISODD(a)), -1, 1)*EXP(a*LN(b)))
Yeah, it would be nice if ^ worked.
It is late here, so you may want to check that formula before relying on it.
@Chris, there is no e in the example because e is a mathematical constant and the basis for exponentials (ie ^). It is the value where e^x = d/dx e^x and e^πi=-1
It's a very important number, but one you will only come across if you do a fair amount of calculus, probably. It makes sense that if you only have one exponential function available that it should be that one, but I would like ^ all the same.
-
Hi
Just an idea but I'm not sure it's that you want.
When I open my terminal and turn on irb, If I type 6**2 and return, I get 36.cheers.
-
Good idea, but doesn't work in DC's. 6**2 just returns 12.
Chris
-
A ruby plugin who doesn't understand ruby languagecheers
-
I'm really sorry to revive this old post, but I'm wondering if the ^ operator has been implimented yet. I've tried to use it using the latest sketchup update (7.1.6087) and it seems to still be missing. It would be nice if Google created a quick fix or patch for this, since it is a very useful operator right next to the four basic operators (+-*/).
Thanks in advance for your help.
Still
-
It has not been implemented yet. I'm sure they've forgotten about it
Chris
-
Hey guys,
We haven't forgotten about this. It's a surprisingly non trivial thing to fix. The actual coding is easy, but then we're introducing a new "version" of DCs that won't work on older Sketchup installs. Your DC that uses ^ would work great in SU 7.1, for example, but not work in 7.0.
If your reply to that is "who cares! people can get a free upgrade!", then let me know and I'll add that to the feature request. In general, we lean toward backwards compatibility.
Cheers,
-
who cares! people can get a free upgrade!
-
uuuh. tricky one. never would have thought about that. but its true, compatibility is a good thing.
although its probably more important for SU 7.1 to read a SU 7 DC properly than for SU 7 to read a SU 7.1 DC properly...therefore in that particular case, I, too, would say: "who cares! people can get a free upgrade!"
-
+1
I'd hate to think that the feature never gets added just to try and keep backwards compatibility. By time we get to verion 10, I think people will be more upset if DC's haven't been improved since v7.0 than if they don't have great backwards compatibility.
Chris
Advertisement