×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

illegal context - can't figure out my error

illegal context - can't figure out my error

illegal context - can't figure out my error

(OP)
Hi all,

I'm a new Mathcad user and am encountering an illegal context error.  I can't figure out the cause of the error.  Lambda is a range variable that is defined.



I did a simple program, reducing this equation down to
b = 1
c = 1
g(x) = 1+x

f(x) = asin[g(x) * sin[b - asin[(1/g(x)) * sin(c)]]]
and it worked fine.  So the issue is obviously in my messy equation above, but I am still not seeing it.  Any ideas?

Thanks!
Martha

RE: illegal context - can't figure out my error

You are missing a square bracket. How did you do that?

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

RE: illegal context - can't figure out my error

Is Ψfs created with Ψ.fs or Ψ[fs?  If the latter, then it cannot be a function name.

RE: illegal context - can't figure out my error

How did you define λ?  Did you use i or another counting variable?  If so, you should include it in your other equations (see your Help screen above).

If λ is a range variable, then why do you want type in its value each time to evaluate ψfs?

Regards,

Cory

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.

RE: illegal context - can't figure out my error

(OP)
IRstuff, I will look at that other forum.  Thanks!

Greg, I fixed the missing square bracket, still get the same result.  Don't know how I managed to define the function with the missing bracket!

jghrist, ?fs was created with ?.fs so no problem there.

Cory, ? is defined as ?:=.700, .. .900 .  I need to evaluate ?fs at one particular ? as well as at all values of ? for use in an equation later in the program.  I am evaluating ?fs at 1 in the above example for debugging purposes.

Thanks all!

Martha

RE: illegal context - can't figure out my error

Martha,

Are you sure you defined λ:.700, .. .900?  MathCad requires a number immediately after the comma or the range will be undefined.  If you typed λ:.700 .. .900, then MathCad assumes the step is equal to 1 and only defines λ= 0.700 since 1.700 is beyond your upper limit.

Regards,

Cory

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips Fora.

RE: illegal context - can't figure out my error

If you defined lambda as a range, then you might get an illegal context message per the help window you posted.  You need to either vectorize the function using <CRTL>+- or explicitly reference the indexed variable with L[i construct

TTFN

RE: illegal context - can't figure out my error

(OP)
Oops!  I defined lambda as follows: lambda:= .700,.701,.. .900 .  (I had previously defined it as 700, .. 900 and the step was 1.)

As for vectorizing the function...since lambda is a range variable, wouldn't that also mean that I would have to vectorize the function nfs(lambda)?  That function evaluates just fine and does not give an error.  

RE: illegal context - can't figure out my error

It's a pretty simple change, so I'd try it, just to see what happens.

TTFN

RE: illegal context - can't figure out my error

a>  Would make it a lot cleaner if you used units, e.g., angles with degrees.  One of Mathcad's main strengths is its ability to incorporate and process units in numerical calculations.  The conversions from degrees to radians simply clutter up the equations.

b>  You must have a typo somewhere.  I copied your sheet (would have been really easier if you had posted it) and don't seem to get your error.  Results were:
0.9729
0.9729
0.9728
0.9728
0.9727
0.9727
0.9727
0.9726
0.9726
0.9725
0.9725
0.9724
0.9724
0.9723
0.9723
0.9723
0.9722
0.9722
0.9721
0.9721
0.9720
0.9720
0.9720
0.9719
0.9719
0.9718
0.9718
0.9717
0.9717
0.9717
0.9716
0.9716
0.9715
0.9715
0.9715
0.9714
0.9714
0.9713
0.9713
0.9712
0.9712
0.9712
0.9711
0.9711
0.9710
0.9710
0.9710
0.9709
0.9709
0.9708
0.9708
0.9708
0.9707
0.9707
0.9707
0.9706
0.9706
0.9705
0.9705
0.9705
0.9704
0.9704
0.9703
0.9703
0.9703
0.9702
0.9702
0.9702
0.9701
0.9701
0.9700
0.9700
0.9700
0.9699
0.9699
0.9699
0.9698
0.9698
0.9697
0.9697
0.9697
0.9696
0.9696
0.9696
0.9695
0.9695
0.9695
0.9694
0.9694
0.9693
0.9693
0.9693
0.9692
0.9692
0.9692
0.9691
0.9691
0.9691
0.9690
0.9690
0.9690
0.9689
0.9689
0.9689
0.9688
0.9688
0.9688
0.9687
0.9687
0.9687
0.9686
0.9686
0.9686
0.9685
0.9685
0.9685
0.9684
0.9684
0.9684
0.9683
0.9683
0.9683
0.9682
0.9682
0.9682
0.9681
0.9681
0.9681
0.9680
0.9680
0.9680
0.9679
0.9679
0.9679
0.9678
0.9678
0.9678
0.9677
0.9677
0.9677
0.9676
0.9676
0.9676
0.9675
0.9675
0.9675
0.9674
0.9674
0.9674
0.9674
0.9673
0.9673
0.9673
0.9672
0.9672
0.9672
0.9671
0.9671
0.9671
0.9670
0.9670
0.9670
0.9670
0.9669
0.9669
0.9669
0.9668
0.9668
0.9668
0.9667
0.9667
0.9667
0.9667
0.9666
0.9666
0.9666
0.9665
0.9665
0.9665
0.9664
0.9664
0.9664
0.9664
0.9663
0.9663
0.9663
0.9662
0.9662
0.9662
0.9662
0.9661
0.9661
0.9661
0.9660
0.9660
0.9660
0.9660
0.9659
0.9659
0.9659
0.9658

TTFN

RE: illegal context - can't figure out my error

Since nfs(lambda) works, the typo is in your final equation.  Near as I can tell, the only non-obvious error would be an implicit multiplication against nfs, e.g., nfs*(lambda) multiplication instead of a function call nfs(lambda).

TTFN

RE: illegal context - can't figure out my error

(OP)
IRstuff,

Thanks for all of your help!  I never got around to posting my program last week, so thank you for taking the time out to reproduce the whole thing.  I will try to figure out where the typo is in my last equation.  Thanks again!

Martha

RE: illegal context - can't figure out my error

(OP)
I found the error.  The argument for the second asin call was being multiplied instead of being taken as the argument.  I never would have caught that before.

Thanks again!

Martha

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close