How do I print out the results of a function F(n, x) where n := 0..10 and x is fixed?

How do I print out the results of a function F(n, x) where n := 0..10 and x is fixed? - Сообщения

#1 Опубликовано: 22.12.2010 20:06:17
VinylCyril

VinylCyril

0 сообщений из 3 понравились пользователям.

Группа: User

Hi everyone.
First of all, immense kudos and thanks to Andrey Ivashov! Spasibo, zemlyak!
This software looks really promising, but I can't yet figure out how to reach a desired result

For example, let's say we have

(which is of course the Maclaurin for e^x) and I want to print out the results of S(n, x) for each value of n (and for each of two arguments, x1 and x2).
However, when I try to do this:

I run into an error shown in the screenshot: Limits must be integer.
If I substitute S with simpler functions, like x^n, the error is just Cannot calculate.

Is there a way to do what I want to do? I get a feeling I'm just using the wrong method.
Thanks in advance!
#2 Опубликовано: 23.12.2010 04:25:55
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello,

Here is one of the possible solutions.
[MATH=eng]x.1←0.71[/MATH]
[MATH=eng]x.2←1.62[/MATH]
[MATH=eng]n←10[/MATH]
[MATH=eng]S(n,x)←line(for(k,range(0,n),el(MC,k+1)←sum(({x^i}/{i!}),i,0,k)),MC,2,1)[/MATH]
[MATH=eng]S(n,x.1)=mat(1,1.71,1.96,2.02,2.03,2.03,2.03,2.03,2.03,2.03,2.03,11,1)[/MATH] [MATH=eng]S(n,x.2)=mat(1,2.62,3.93,4.64,4.93,5.02,5.05,5.05,5.05,5.05,5.05,11,1)[/MATH]

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 23.12.2010 19:07:16
VinylCyril

VinylCyril

0 сообщений из 3 понравились пользователям.

Группа: User

One simple question though: how do I make that big vertical line in front of the for structure?
Either I'm looking in a wrong place again, or the documentation for SMath doesn't cover everything yet.
#4 Опубликовано: 23.12.2010 19:35:05
Brian Runagle

Brian Runagle

13 сообщений из 27 понравились пользователям.

Группа: User

Look in the Programming section of the side panel and select Line. It can be extended by selecting it and dragging the marker downwards.

Make sure the side panel is enabled, there's an icon in the menu bar to do this.

Hope this helps.

Brian
#5 Опубликовано: 23.12.2010 19:52:11
VinylCyril

VinylCyril

0 сообщений из 3 понравились пользователям.

Группа: User

Thanks!
I was kinda dumb for not noticing the "line" button right next to the known to me "for" one

Everything now works like a charm, thank you so much!

Where can I read about such constructions and more? I still have no idea what MC stands for, etc, etc.
#6 Опубликовано: 24.12.2010 06:05:52
Brian Runagle

Brian Runagle

13 сообщений из 27 понравились пользователям.

Группа: User

Don't worry, it happens to all of us!

Regarding more info, have a look here:
https://smath.com/wiki/Tutorials.ashx

There's an Introduction to version 0.88 and an updated Introduction to Programming, both from Gilberto Urroz.

Have fun

Brian
#7 Опубликовано: 24.12.2010 06:08:03
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello,
Wrote


Where can I read about such constructions and more? I still have no idea what MC stands for, etc, etc.


I would agree with Brian and suggest you to read the material on the Wiki (Tutorials, Examples etc.). I think you would not need to much time to read it.
BTW.,MC is a vector name (vector - column matrix, single index). This name is not important, you could have put here whatever you want. This is just a vector name which the multiple line function ( defined with "line" ) will return as its result (the last name in the "line" environment)

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений