Message Boards Message Boards

[✓] Set a function with conditions?

GROUPS:

The problem is : Use conditions to give a function pow[x,r]. Be sure to use the string "imaginary", and to test your result on pow[0,0], pow[2,0], pow[2,2], pow[-1,1/3], pow[-1,1/2], and pow[-1, [Pi]]. I'm unsure how to set it up to correctly for example, when I try pow[x, r] := "undefined" /; x = 0 && r = 0, it gives me 0 instead of undefined as the output

POSTED BY: Michelle Chen
Answer
2 months ago

Use == for testing if something is “equal”. A single equal is “Set”. You will need to quit your kernel because you assigned a value to x and r.

POSTED BY: Neil Singer
Answer
2 months ago

Thank you so much ! It worked after I used ==

POSTED BY: Michelle Chen
Answer
2 months ago

Group Abstract Group Abstract